aboutsummaryrefslogtreecommitdiffstats
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 00ecd4e..2f90778 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -78,18 +78,31 @@ void print_commit(struct commit *commit)
78 cgit_free_commitinfo(info); 78 cgit_free_commitinfo(info);
79} 79}
80 80
81static const char *disambiguate_ref(const char *ref)
82{
83 unsigned char sha1[20];
84 const char *longref;
85
86 longref = fmt("refs/heads/%s", ref);
87 if (get_sha1(longref, sha1) == 0)
88 return longref;
89
90 return ref;
91}
81 92
82void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, 93void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
83 char *path, int pager) 94 char *path, int pager)
84{ 95{
85 struct rev_info rev; 96 struct rev_info rev;
86 struct commit *commit; 97 struct commit *commit;
87 const char *argv[] = {NULL, tip, NULL, NULL, NULL}; 98 const char *argv[] = {NULL, NULL, NULL, NULL, NULL};
88 int argc = 2; 99 int argc = 2;
89 int i, columns = 3; 100 int i, columns = 3;
90 101
91 if (!tip) 102 if (!tip)
92 argv[1] = ctx.qry.head; 103 tip = ctx.qry.head;
104
105 argv[1] = disambiguate_ref(tip);
93 106
94 if (grep && pattern && (!strcmp(grep, "grep") || 107 if (grep && pattern && (!strcmp(grep, "grep") ||
95 !strcmp(grep, "author") || 108 !strcmp(grep, "author") ||