summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-09-26 14:39:43 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-09-26 14:39:43 -0700
commit9bc4222746a09d57998903dab0361b1d7adc271f (patch)
tree5f20a43b111398ee507568e92296697e03a1392e /t
parentMerge branch 'jk/write-packed-refs-via-stdio' (diff)
parentrefs: speed up is_refname_available (diff)
downloadtgif-9bc4222746a09d57998903dab0361b1d7adc271f.tar.xz
Merge branch 'jk/faster-name-conflicts'
Optimize the check to see if a ref $F can be created by making sure no existing ref has $F/ as its prefix, which especially matters in a repository with a large number of existing refs. * jk/faster-name-conflicts: refs: speed up is_refname_available
Diffstat (limited to 't')
-rwxr-xr-xt/t3210-pack-refs.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 3a017bf437..aa9eb3a3e5 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -11,7 +11,9 @@ semantic is still the same.
'
. ./test-lib.sh
-echo '[core] logallrefupdates = true' >>.git/config
+test_expect_success 'enable reflogs' '
+ git config core.logallrefupdates true
+'
test_expect_success \
'prepare a trivial repository' \
@@ -158,4 +160,31 @@ test_expect_success 'pack ref directly below refs/' '
test_path_is_missing .git/refs/top
'
+test_expect_success 'disable reflogs' '
+ git config core.logallrefupdates false &&
+ rm -rf .git/logs
+'
+
+test_expect_success 'create packed foo/bar/baz branch' '
+ git branch foo/bar/baz &&
+ git pack-refs --all --prune &&
+ test_path_is_missing .git/refs/heads/foo/bar/baz &&
+ test_path_is_missing .git/logs/refs/heads/foo/bar/baz
+'
+
+test_expect_success 'notice d/f conflict with existing directory' '
+ test_must_fail git branch foo &&
+ test_must_fail git branch foo/bar
+'
+
+test_expect_success 'existing directory reports concrete ref' '
+ test_must_fail git branch foo 2>stderr &&
+ grep refs/heads/foo/bar/baz stderr
+'
+
+test_expect_success 'notice d/f conflict with existing ref' '
+ test_must_fail git branch foo/bar/baz/extra &&
+ test_must_fail git branch foo/bar/baz/lots/of/extra/components
+'
+
test_done