git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
ca70cf3fe28ebfcdaf592aa0947a8dae0f1d7010 blob 2387 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
#!/bin/sh

test_description='directory traversal respects worktree config

This test configures the repository`s worktree to be two levels above the
`.git` directory and checks whether we are able to add to the index those files
that are in either (1) the manually configured worktree directory or (2) the
standard worktree location with respect to the `.git` directory (i.e. ensuring
that the encountered `.git` directory is not treated as belonging to a foreign
nested repository)'

. ./test-lib.sh

test_expect_success '1a: setup' '
	test_create_repo test1 &&
	git --git-dir="test1/.git" config core.worktree "$(pwd)" &&

	mkdir -p outside-tracked outside-untracked &&
	mkdir -p test1/inside-tracked test1/inside-untracked &&
	>file-tracked &&
	>file-untracked &&
	>outside-tracked/file &&
	>outside-untracked/file &&
	>test1/file-tracked &&
	>test1/file-untracked &&
	>test1/inside-tracked/file &&
	>test1/inside-untracked/file &&

	cat >expect-tracked-unsorted <<-EOF &&
	../file-tracked
	../outside-tracked/file
	file-tracked
	inside-tracked/file
	EOF

	cat >expect-untracked-unsorted <<-EOF &&
	../file-untracked
	../outside-untracked/file
	file-untracked
	inside-untracked/file
	EOF

	cat expect-tracked-unsorted expect-untracked-unsorted >expect-all-unsorted &&

	cat >.gitignore <<-EOF
	.gitignore
	actual-*
	expect-*
	EOF
'

test_expect_success '1b: pre-add all' '
	local parent_dir="$(pwd)" &&
	(
		cd test1 &&
		git ls-files -o --exclude-standard "$parent_dir" >../actual-all-unsorted
	) &&
	sort actual-all-unsorted >actual-all &&
	sort expect-all-unsorted >expect-all &&
	test_cmp expect-all actual-all
'

test_expect_success '1c: post-add tracked' '
	local parent_dir="$(pwd)" &&
	(
		cd test1 &&
		git add file-tracked &&
		git add inside-tracked &&
		git add ../outside-tracked &&
		git add "$parent_dir/file-tracked" &&
		git ls-files "$parent_dir" >../actual-tracked-unsorted
	) &&
	sort actual-tracked-unsorted >actual-tracked &&
	sort expect-tracked-unsorted >expect-tracked &&
	test_cmp expect-tracked actual-tracked
'

test_expect_success '1d: post-add untracked' '
	local parent_dir="$(pwd)" &&
	(
		cd test1 &&
		git ls-files -o --exclude-standard "$parent_dir" >../actual-untracked-unsorted
	) &&
	sort actual-untracked-unsorted >actual-untracked &&
	sort expect-untracked-unsorted >expect-untracked &&
	test_cmp expect-untracked actual-untracked
'

test_done
debug log:

solving ca70cf3fe2 ...
found ca70cf3fe2 in https://public-inbox.org/git/20220510171527.25778-2-ggossdev@gmail.com/

applying [1/1] https://public-inbox.org/git/20220510171527.25778-2-ggossdev@gmail.com/
diff --git a/t/t2205-add-worktree-config.sh b/t/t2205-add-worktree-config.sh
new file mode 100755
index 0000000000..ca70cf3fe2

Checking patch t/t2205-add-worktree-config.sh...
Applied patch t/t2205-add-worktree-config.sh cleanly.

index at:
100755 ca70cf3fe28ebfcdaf592aa0947a8dae0f1d7010	t/t2205-add-worktree-config.sh

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).