about summary refs log tree commit diff
path: root/ui-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-log.c')
-rw-r--r--ui-log.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ui-log.c b/ui-log.c
index 8dd8b89..d212984 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -64,18 +64,31 @@ void print_commit(struct commit *commit)
 	cgit_free_commitinfo(info);
 }
 
+static const char *disambiguate_ref(const char *ref)
+{
+	unsigned char sha1[20];
+	const char *longref;
+
+	longref = fmt("refs/heads/%s", ref);
+	if (get_sha1(longref, sha1) == 0)
+		return longref;
+
+	return ref;
+}
 
 void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
 		    char *path, int pager)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	const char *argv[] = {NULL, tip, NULL, NULL, NULL};
+	const char *argv[] = {NULL, NULL, NULL, NULL, NULL};
 	int argc = 2;
 	int i, columns = 3;
 
 	if (!tip)
-		argv[1] = ctx.qry.head;
+		tip = ctx.qry.head;
+
+	argv[1] = disambiguate_ref(tip);
 
 	if (grep && pattern && (!strcmp(grep, "grep") ||
 				!strcmp(grep, "author") ||
1b2ffc612fc8&follow=1'>Remove deprecated option namesJune McEnroe 2020-08-25Document configuration and data file searchJune McEnroe 2020-08-24Use dataOpen for save fileJune McEnroe 2020-08-24Use configOpen to load localCAJune McEnroe 2020-08-24Use configPath to load client cert/privJune McEnroe 2020-08-24Use configOpen in getopt_configJune McEnroe 2020-08-24Import xdg.c from catgirlJune McEnroe 2020-08-23Replace “RAND_bytes” by “getentropy”Issam E. Maghni 2020-08-16contrib/palaver: Add no message preview flagsJune McEnroe 2020-08-13contrib/palaver: Don't set channel for PMsJune McEnroe 2020-08-13Fix unintended interception of NICK after registrationJune McEnroe 2020-08-12Add Additional Components section to READMEJune McEnroe 2020-08-12Document -L / palaver optionJune McEnroe 2020-08-11contrib/palaver: Document service configurationJune McEnroe 2020-08-11contrib/palaver: Add install target and rc scriptJune McEnroe 2020-08-11contrib/palaver: Implement command and notificationsJune McEnroe