]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote-curl: avoid truncating refs with ls-remote
authorbrian m. carlson <sandals@crustytoothpaste.net>
Fri, 19 Jun 2020 17:55:54 +0000 (17:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jun 2020 21:04:08 +0000 (14:04 -0700)
Normally, the remote-curl transport helper is aware of the hash
algorithm we're using because we're in a repo with the appropriate hash
algorithm set. However, when using git ls-remote outside of a
repository, we won't have initialized the hash algorithm properly, so
use hash_to_hex_algop to print the ref corresponding to the algorithm
we've detected.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote-curl.c

index 774a1ca71feb2fdd665190310eb443ca5ef7cf91..0090e68f4a7c035644a53dabe48754f78d80c8ae 100644 (file)
@@ -548,7 +548,9 @@ static void output_refs(struct ref *refs)
                if (posn->symref)
                        printf("@%s %s\n", posn->symref, posn->name);
                else
-                       printf("%s %s\n", oid_to_hex(&posn->old_oid), posn->name);
+                       printf("%s %s\n", hash_to_hex_algop(posn->old_oid.hash,
+                                                           options.hash_algo),
+                                         posn->name);
        }
        printf("\n");
        fflush(stdout);