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>2015-10-05 06:46:04 +0300
committerJunio C Hamano <gitster@pobox.com>2015-10-05 21:07:04 +0300
commit9c28390bda4bb86f48a3145417c1cb1892782c47 (patch)
tree61720ec3de74f3a84a8885f5585e91948b4d68cd /t/t0001-init.sh
parentfdf729661a777d8bd598f40055d92b2df5601332 (diff)
init: use strbufs to store paths
The init code predates strbufs, and uses PATH_MAX-sized buffers along with many manual checks on intermediate sizes (some of which make magic assumptions, such as that init will not create a path inside .git longer than 50 characters). We can simplify this greatly by using strbufs, which drops some hard-to-verify strcpy calls in favor of git_path_buf. While we're in the area, let's also convert existing calls to git_path to the safer git_path_buf (our existing calls were passed to pretty tame functions, and so were not a problem, but it's easy to be consistent and safe here). Note that we had an explicit test that "git init" rejects long template directories. This comes from 32d1776 (init: Do not segfault on big GIT_TEMPLATE_DIR environment variable, 2009-04-18). We can drop the test_must_fail here, as we now accept this and need only confirm that we don't segfault, which was the original point of the test. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 7de8d85ee8..f91bbcfc85 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -202,8 +202,8 @@ test_expect_success 'init honors global core.sharedRepository' '
x$(git config -f shared-honor-global/.git/config core.sharedRepository)
'
-test_expect_success 'init rejects insanely long --template' '
- test_must_fail git init --template=$(printf "x%09999dx" 1) test
+test_expect_success 'init allows insanely long --template' '
+ git init --template=$(printf "x%09999dx" 1) test
'
test_expect_success 'init creates a new directory' '