Skip to content

Commit 97997e6

Browse files
bk2204gitster
authored andcommitted
remote-curl: avoid truncating refs with ls-remote
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 793731f commit 97997e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

remote-curl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,9 @@ static void output_refs(struct ref *refs)
548548
if (posn->symref)
549549
printf("@%s %s\n", posn->symref, posn->name);
550550
else
551-
printf("%s %s\n", oid_to_hex(&posn->old_oid), posn->name);
551+
printf("%s %s\n", hash_to_hex_algop(posn->old_oid.hash,
552+
options.hash_algo),
553+
posn->name);
552554
}
553555
printf("\n");
554556
fflush(stdout);

0 commit comments

Comments
 (0)