Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-10-03 23:36:26 +0300
committerJunio C Hamano <gitster@pobox.com>2016-10-10 23:52:37 +0300
commitea0fc3b4176a424a2b20eb76a6a503dc4d59cebb (patch)
treefcb3e3cc6bf9b74eaf5c1f7596701bb0a0135f3d /t/t5613-info-alternate.sh
parent087b6d584062f5b704356286d6445bcc84d686fb (diff)
alternates: use fspathcmp to detect duplicates
On a case-insensitive filesystem, we should realize that "a/objects" and "A/objects" are the same path. We already use fspathcmp() to check against the main object directory, but until recently we couldn't use it for comparing against other alternates (because their paths were not NUL-terminated strings). But now we can, so let's do so. Note that we also need to adjust count-objects to load the config, so that it can see the setting of core.ignorecase (this is required by the test, but is also a general bugfix for users of count-objects). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5613-info-alternate.sh')
-rwxr-xr-xt/t5613-info-alternate.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t5613-info-alternate.sh b/t/t5613-info-alternate.sh
index 76f1a20e2c..895f46bb91 100755
--- a/t/t5613-info-alternate.sh
+++ b/t/t5613-info-alternate.sh
@@ -119,4 +119,21 @@ test_expect_success 'relative duplicates are eliminated' '
test_cmp expect actual.alternates
'
+test_expect_success CASE_INSENSITIVE_FS 'dup finding can be case-insensitive' '
+ git init --bare insensitive.git &&
+ # the previous entry for "A" will have used uppercase
+ cat >insensitive.git/objects/info/alternates <<-\EOF &&
+ ../../C/.git/objects
+ ../../a/.git/objects
+ EOF
+ cat >expect <<-EOF &&
+ alternate: $(pwd)/C/.git/objects
+ alternate: $(pwd)/B/.git/objects
+ alternate: $(pwd)/A/.git/objects
+ EOF
+ git -C insensitive.git count-objects -v >actual &&
+ grep ^alternate: actual >actual.alternates &&
+ test_cmp expect actual.alternates
+'
+
test_done