This replaces the previous behaviour of disambiguate_ref,
which would only prepend refs/heads to the branch name,
so would not disambiguate tags to their full refs.

Now when an abbreviated ref is provided
the namespace is prepended to it
as well as the disambiguating path.

Signed-off-by: Richard Maw <[email protected]>
---
 ui-log.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/ui-log.c b/ui-log.c
index 28ef3c0..71ef3d4 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -322,16 +322,12 @@ static void print_commit(struct commit *commit, struct 
rev_info *revs)
 static const char *disambiguate_ref(const char *ref, int *must_free_result)
 {
        struct object_id oid;
-       struct strbuf longref = STRBUF_INIT;
 
-       strbuf_addf(&longref, "refs/heads/%s", ref);
-       if (cgit_get_sha1(longref.buf, oid.hash) == 0) {
+       if (cgit_namespaced_dwim_ref(ref, oid.hash, (char**)&ref))
                *must_free_result = 1;
-               return strbuf_detach(&longref, NULL);
-       }
+       else
+               *must_free_result = 0;
 
-       *must_free_result = 0;
-       strbuf_release(&longref);
        return ref;
 }
 
-- 
2.9.0

_______________________________________________
CGit mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to