diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-15 14:11:43 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-15 14:11:43 -0700 |
commit | 372aabe91285b8c50eaf513488fa2c3c529c1eec (patch) | |
tree | 9b51d708f55544f80c43f4e432418875de920d0d | |
parent | d75ec4c62715fd768a56523f714fe9ecd2b1abb3 (diff) | |
parent | 69d87802da45de04c705351a397f76a691d596ea (diff) | |
download | git-372aabe91285b8c50eaf513488fa2c3c529c1eec.tar.gz |
Merge branch 'ps/t0610-umask-fix'
The "shared repository" test in the t0610 reftable test failed
under restrictive umask setting (e.g. 007), which has been
corrected.
* ps/t0610-umask-fix:
t0610: execute git-pack-refs(1) with specified umask
t0610: make `--shared=` tests reusable
-rwxr-xr-x | t/t0610-reftable-basics.sh | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 931d888bbb..38a535b041 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -96,23 +96,54 @@ test_expect_perms () { esac } -for umask in 002 022 -do - test_expect_success POSIXPERM 'init: honors core.sharedRepository' ' +test_expect_reftable_perms () { + local umask="$1" + local shared="$2" + local expect="$3" + + test_expect_success POSIXPERM "init: honors --shared=$shared with umask $umask" ' test_when_finished "rm -rf repo" && ( umask $umask && - git init --shared=true repo && - test 1 = "$(git -C repo config core.sharedrepository)" + git init --shared=$shared repo ) && - test_expect_perms "-rw-rw-r--" repo/.git/reftable/tables.list && + test_expect_perms "$expect" repo/.git/reftable/tables.list && for table in repo/.git/reftable/*.ref do - test_expect_perms "-rw-rw-r--" "$table" || + test_expect_perms "$expect" "$table" || return 1 done ' -done + + test_expect_success POSIXPERM "pack-refs: honors --shared=$shared with umask $umask" ' + test_when_finished "rm -rf repo" && + ( + umask $umask && + git init --shared=$shared repo && + test_commit -C repo A && + test_line_count = 3 repo/.git/reftable/tables.list && + git -C repo pack-refs + ) && + test_expect_perms "$expect" repo/.git/reftable/tables.list && + for table in repo/.git/reftable/*.ref + do + test_expect_perms "$expect" "$table" || + return 1 + done + ' +} + +test_expect_reftable_perms 002 umask "-rw-rw-r--" +test_expect_reftable_perms 022 umask "-rw-r--r--" +test_expect_reftable_perms 027 umask "-rw-r-----" + +test_expect_reftable_perms 002 group "-rw-rw-r--" +test_expect_reftable_perms 022 group "-rw-rw-r--" +test_expect_reftable_perms 027 group "-rw-rw----" + +test_expect_reftable_perms 002 world "-rw-rw-r--" +test_expect_reftable_perms 022 world "-rw-rw-r--" +test_expect_reftable_perms 027 world "-rw-rw-r--" test_expect_success 'clone: can clone reftable repository' ' test_when_finished "rm -rf repo clone" && @@ -450,26 +481,6 @@ test_expect_success 'pack-refs: does not prune non-table files' ' test_path_is_file repo/.git/reftable/garbage ' -for umask in 002 022 -do - test_expect_success POSIXPERM 'pack-refs: honors core.sharedRepository' ' - test_when_finished "rm -rf repo" && - ( - umask $umask && - git init --shared=true repo && - test_commit -C repo A && - test_line_count = 3 repo/.git/reftable/tables.list - ) && - git -C repo pack-refs && - test_expect_perms "-rw-rw-r--" repo/.git/reftable/tables.list && - for table in repo/.git/reftable/*.ref - do - test_expect_perms "-rw-rw-r--" "$table" || - return 1 - done - ' -done - test_expect_success 'packed-refs: writes are synced' ' test_when_finished "rm -rf repo" && git init repo && |