-rw-r--r-- | ui-log.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -65,4 +65,15 @@ void print_commit(struct commit *commit) } +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, @@ -71,10 +82,12 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern 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") || |