git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
f7b0ea782ed16d647160fae5c456ef82a326d5f9 blob 2215 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
90
91
92
 
#!/bin/sh

test_description='git add in sparse checked out working trees'

. ./test-lib.sh

SPARSE_ENTRY_BLOB=""

# Optionally take a string for the entry's contents
setup_sparse_entry()
{
	if test -f sparse_entry
	then
		rm sparse_entry
	fi &&
	git update-index --force-remove sparse_entry &&

	if test "$#" -eq 1
	then
		printf "$1" >sparse_entry
	else
		printf "" >sparse_entry
	fi &&
	git add sparse_entry &&
	git update-index --skip-worktree sparse_entry &&
	SPARSE_ENTRY_BLOB=$(git rev-parse :sparse_entry)
}

test_sparse_entry_unchanged() {
	echo "100644 $SPARSE_ENTRY_BLOB 0	sparse_entry" >expected &&
	git ls-files --stage sparse_entry >actual &&
	test_cmp expected actual
}

test_expect_success "git add does not remove SKIP_WORKTREE entries" '
	setup_sparse_entry &&
	rm sparse_entry &&
	git add sparse_entry &&
	test_sparse_entry_unchanged
'

test_expect_success "git add -A does not remove SKIP_WORKTREE entries" '
	setup_sparse_entry &&
	rm sparse_entry &&
	git add -A &&
	test_sparse_entry_unchanged
'

for opt in "" -f -u --ignore-removal
do
	if test -n "$opt"
	then
		opt=" $opt"
	fi

	test_expect_success "git add$opt does not update SKIP_WORKTREE entries" '
		setup_sparse_entry &&
		echo modified >sparse_entry &&
		git add $opt sparse_entry &&
		test_sparse_entry_unchanged
	'
done

test_expect_success 'git add --refresh does not update SKIP_WORKTREE entries' '
	setup_sparse_entry &&
	test-tool chmtime -60 sparse_entry &&
	git add --refresh sparse_entry &&

	# We must unset the SKIP_WORKTREE bit, otherwise
	# git diff-files would skip examining the file
	git update-index --no-skip-worktree sparse_entry &&

	echo sparse_entry >expected &&
	git diff-files --name-only sparse_entry >actual &&
	test_cmp actual expected
'

test_expect_success 'git add --chmod does not update SKIP_WORKTREE entries' '
	setup_sparse_entry &&
	git add --chmod=+x sparse_entry &&
	test_sparse_entry_unchanged
'

test_expect_success 'git add --renormalize does not update SKIP_WORKTREE entries' '
	test_config core.autocrlf false &&
	setup_sparse_entry "LINEONE\r\nLINETWO\r\n" &&
	echo "sparse_entry text=auto" >.gitattributes &&
	git add --renormalize sparse_entry &&
	test_sparse_entry_unchanged
'

test_done
debug log:

solving f7b0ea782e ...
found f7b0ea782e in https://public-inbox.org/git/f8893577c7a0269670abbd67f94f42462ba0791a.1613593946.git.matheus.bernardino@usp.br/
found 5530e796b5 in https://public-inbox.org/git/6e30f133e234ff1d3a29f36423cd3fdca58d8095.1613593946.git.matheus.bernardino@usp.br/

applying [1/2] https://public-inbox.org/git/6e30f133e234ff1d3a29f36423cd3fdca58d8095.1613593946.git.matheus.bernardino@usp.br/
diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh
new file mode 100755
index 0000000000..5530e796b5


applying [2/2] https://public-inbox.org/git/f8893577c7a0269670abbd67f94f42462ba0791a.1613593946.git.matheus.bernardino@usp.br/
diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh
index 5530e796b5..f7b0ea782e 100755

Checking patch t/t3705-add-sparse-checkout.sh...
Applied patch t/t3705-add-sparse-checkout.sh cleanly.
Checking patch t/t3705-add-sparse-checkout.sh...
Applied patch t/t3705-add-sparse-checkout.sh cleanly.

index at:
100755 f7b0ea782ed16d647160fae5c456ef82a326d5f9	t/t3705-add-sparse-checkout.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).