summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-10 08:02:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-10 08:02:50 (GMT)
commitc2e19411a7bbf5d3f00df786bb65cfa5cd5d854c (patch)
tree33f5b95c35ef8bc59c061baa648b442774c8a718
parent277194a28050c2eabb605994d592d8e46cab6302 (diff)
parentbed67874e235e8f128607728f9a03c71e92cb955 (diff)
downloadgit-c2e19411a7bbf5d3f00df786bb65cfa5cd5d854c.zip
git-c2e19411a7bbf5d3f00df786bb65cfa5cd5d854c.tar.gz
git-c2e19411a7bbf5d3f00df786bb65cfa5cd5d854c.tar.bz2
Merge branch 'rs/obsd-getcwd-workaround' into maint
Test portability fix for BSDs. * rs/obsd-getcwd-workaround: t0001: skip test with restrictive permissions if getpwd(3) respects them
-rwxr-xr-xt/t0001-init.sh30
1 files changed, 28 insertions, 2 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index c4814d2..86c1a51 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -315,18 +315,44 @@ test_expect_success 'init with separate gitdir' '
test_path_is_dir realgitdir/refs
'
-test_expect_success 'init in long base path' '
+test_lazy_prereq GETCWD_IGNORES_PERMS '
+ base=GETCWD_TEST_BASE_DIR &&
+ mkdir -p $base/dir &&
+ chmod 100 $base ||
+ error "bug in test script: cannot prepare $base"
+
+ (cd $base/dir && /bin/pwd -P)
+ status=$?
+
+ chmod 700 $base &&
+ rm -rf $base ||
+ error "bug in test script: cannot clean $base"
+ return $status
+'
+
+check_long_base_path () {
# exceed initial buffer size of strbuf_getcwd()
component=123456789abcdef &&
test_when_finished "chmod 0700 $component; rm -rf $component" &&
p31=$component/$component &&
p127=$p31/$p31/$p31/$p31 &&
mkdir -p $p127 &&
- chmod 0111 $component &&
+ if test $# = 1
+ then
+ chmod $1 $component
+ fi &&
(
cd $p127 &&
git init newdir
)
+}
+
+test_expect_success 'init in long base path' '
+ check_long_base_path
+'
+
+test_expect_success GETCWD_IGNORES_PERMS 'init in long restricted base path' '
+ check_long_base_path 0111
'
test_expect_success 're-init on .git file' '