git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 3/3] t1700: make sure split-index respects core.sharedrepository

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 25, 2017, 04:34 UTC
Message-ID
<20170625043429.23337-3-chriscool@tuxfamily.org>
In-Reply-To
<20170625043429.23337-1-chriscool@tuxfamily.org>

Add a few tests to check that both the split-index file and the shared-index file are created using the right permissions when core.sharedrepository is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/t1700-split-index.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index af3ec0da5a..22f69a410b 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -370,4 +370,34 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"
 	test $(ls .git/sharedindex.* | wc -l) -le 2
 '
 
+while read -r mode modebits
+do
+	test_expect_success POSIXPERM "split index respects core.sharedrepository $mode" '
+		# Remove existing shared index files
+		git config core.splitIndex false &&
+		git update-index --force-remove one &&
+		rm -f .git/sharedindex.* &&
+		# Create one new shared index file
+		git config core.sharedrepository "$mode" &&
+		git config core.splitIndex true &&
+		: >one &&
+		git update-index --add one &&
+		echo "$modebits" >expect &&
+		test_modebits .git/index >actual &&
+		test_cmp expect actual &&
+		shared=$(ls .git/sharedindex.*) &&
+		case "$shared" in
+		*" "*)
+			# we have more than one???
+			false ;;
+		*)
+			test_modebits "$shared" >actual &&
+			test_cmp expect actual ;;
+		esac
+	'
+done <<\EOF
+0666 -rw-rw-rw-
+0642 -rw-r---w-
+EOF
+
 test_done
-- 
2.13.1.517.gf6399a5ea5
Previous: Christian Couder
Message 3 of 3 in “read-cache: use shared perms when writing shared index”
  1. 1/3 read-cache: use shared perms when writing shared indexChristian Couder, Jun 25, 2017
  2. 2/3 t1301: move modebits() to test-lib-functions.shChristian Couder, Jun 25, 2017
  3. 3/3 t1700: make sure split-index respects core.sharedrepositoryChristian Couder, Jun 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.