Merge branch 'ps/refname-avail-check-optim'
Incorrect sorting of refs with bytes with high-bit set on platforms with signed char led to a BUG, which has been corrected. * ps/refname-avail-check-optim: refs/packed: fix BUG when seeking refs with UTF-8 charactersmaint
commit
c81538ea6c
|
@ -980,9 +980,9 @@ static int packed_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||
continue;
|
||||
|
||||
while (prefix && *prefix) {
|
||||
if (*refname < *prefix)
|
||||
if ((unsigned char)*refname < (unsigned char)*prefix)
|
||||
BUG("packed-refs backend yielded reference preceding its prefix");
|
||||
else if (*refname > *prefix)
|
||||
else if ((unsigned char)*refname > (unsigned char)*prefix)
|
||||
return ITER_DONE;
|
||||
prefix++;
|
||||
refname++;
|
||||
|
|
|
@ -42,4 +42,19 @@ test_expect_success 'no error from stale entry in packed-refs' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'list packed refs with unicode characters' '
|
||||
test_when_finished "rm -rf repo" &&
|
||||
git init repo &&
|
||||
(
|
||||
cd repo &&
|
||||
test_commit --no-tag A &&
|
||||
git update-ref refs/heads/ HEAD &&
|
||||
git update-ref refs/heads/z HEAD &&
|
||||
git pack-refs --all &&
|
||||
printf "%s commit\trefs/heads/z\n" $(git rev-parse HEAD) >expect &&
|
||||
git for-each-ref refs/heads/z >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in New Issue