summaryrefslogtreecommitdiff
path: root/ui-log.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2008-12-06 11:33:05 +0100
committerLars Hjemli <hjemli@gmail.com>2008-12-06 11:33:05 +0100
commit3157ea3b7e5204dba2892ffb54d641746c4c7ca4 (patch)
tree93198341d83438fce50ffeda19b2510138b7b2e5 /ui-log.c
parent7b5cee65fd9cf31e4f19ce4ff613778cb95512a9 (diff)
parentd2592a2cb5ca202d9825d8f1ca6f4a712ea8fe2b (diff)
Merge branch 'stable'
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") ||