From: Junio C Hamano Date: Fri, 26 Sep 2014 21:39:43 +0000 (-0700) Subject: Merge branch 'jk/faster-name-conflicts' X-Git-Tag: v2.2.0-rc0~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bc4222746a09d57998903dab0361b1d7adc271f;p=thirdparty%2Fgit.git 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 --- 9bc4222746a09d57998903dab0361b1d7adc271f diff --cc t/t3210-pack-refs.sh index 3a017bf437,3d5cb4c089..aa9eb3a3e5 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@@ -151,11 -153,31 +153,38 @@@ test_expect_success 'delete ref while a test_cmp /dev/null result ' +test_expect_success 'pack ref directly below refs/' ' + git update-ref refs/top HEAD && + git pack-refs --all --prune && + grep refs/top .git/packed-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