summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2020-04-29 17:36:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-29 19:35:30 (GMT)
commitf4d62847a431af965b8a6895b92f4372042457b0 (patch)
treea0348d9085c67b2ad3b9605137d2ceaefffd8cbc /t
parent1f9becaedc9266651145a146fb63b84c3ee79d95 (diff)
downloadgit-f4d62847a431af965b8a6895b92f4372042457b0.zip
git-f4d62847a431af965b8a6895b92f4372042457b0.tar.gz
git-f4d62847a431af965b8a6895b92f4372042457b0.tar.bz2
commit-graph.c: ensure graph layers respect core.sharedRepository
Non-layered commit-graphs use 'adjust_shared_perm' to make the commit-graph file readable (or not) to a combination of the user, group, and others. Call 'adjust_shared_perm' for split-graph layers to make sure that these also respect 'core.sharedRepository'. The 'commit-graph-chain' file already respects this configuration since it uses 'hold_lock_file_for_update' (which calls 'adjust_shared_perm' eventually in 'create_tempfile_mode'). Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5324-split-commit-graph.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index 53b2e6b..699c23d 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -36,6 +36,10 @@ graph_read_expect() {
test_cmp expect output
}
+test_expect_success POSIXPERM 'tweak umask for modebit tests' '
+ umask 022
+'
+
test_expect_success 'create commits and write commit-graph' '
for i in $(test_seq 3)
do
@@ -351,4 +355,22 @@ test_expect_success 'split across alternate where alternate is not split' '
test_cmp commit-graph .git/objects/info/commit-graph
'
+while read mode modebits
+do
+ test_expect_success POSIXPERM "split commit-graph respects core.sharedrepository $mode" '
+ rm -rf $graphdir $infodir/commit-graph &&
+ git reset --hard commits/1 &&
+ test_config core.sharedrepository "$mode" &&
+ git commit-graph write --split --reachable &&
+ ls $graphdir/graph-*.graph >graph-files &&
+ test_line_count = 1 graph-files &&
+ echo "$modebits" >expect &&
+ test_modebits $graphdir/graph-*.graph >actual &&
+ test_cmp expect actual
+ '
+done <<\EOF
+0666 -r--r--r--
+0600 -r--------
+EOF
+
test_done