git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
c6f7832556332778e388dcc13438acf4073851a4 blob 3657 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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
#!/bin/sh

test_description='avoid rewriting packed-refs unnecessarily'

. ./test-lib.sh

if test_have_prereq REFTABLE
then
  skip_all='skipping pack-refs tests; incompatible with reftable'
  test_done
fi

# Add an identifying mark to the packed-refs file header line. This
# shouldn't upset readers, and it should be omitted if the file is
# ever rewritten.
mark_packed_refs () {
	sed -e "s/^\(#.*\)/\1 t1409 /" .git/packed-refs >.git/packed-refs.new &&
	mv .git/packed-refs.new .git/packed-refs
}

# Verify that the packed-refs file is still marked.
check_packed_refs_marked () {
	grep -q '^#.* t1409 ' .git/packed-refs
}

test_expect_success 'setup' '
	git commit --allow-empty -m "Commit A" &&
	A=$(git rev-parse HEAD) &&
	git commit --allow-empty -m "Commit B" &&
	B=$(git rev-parse HEAD) &&
	git commit --allow-empty -m "Commit C" &&
	C=$(git rev-parse HEAD)
'

test_expect_success 'do not create packed-refs file gratuitously' '
	test_path_is_missing .git/packed-refs &&
	git update-ref refs/heads/foo $A &&
	test_path_is_missing .git/packed-refs &&
	git update-ref refs/heads/foo $B &&
	test_path_is_missing .git/packed-refs &&
	git update-ref refs/heads/foo $C $B &&
	test_path_is_missing .git/packed-refs &&
	git update-ref -d refs/heads/foo &&
	test_path_is_missing .git/packed-refs
'

test_expect_success 'check that marking the packed-refs file works' '
	git for-each-ref >expected &&
	git pack-refs --all &&
	mark_packed_refs &&
	check_packed_refs_marked &&
	git for-each-ref >actual &&
	test_cmp expected actual &&
	git pack-refs --all &&
	! check_packed_refs_marked &&
	git for-each-ref >actual2 &&
	test_cmp expected actual2
'

test_expect_success 'leave packed-refs untouched on update of packed' '
	git update-ref refs/heads/packed-update $A &&
	git pack-refs --all &&
	mark_packed_refs &&
	git update-ref refs/heads/packed-update $B &&
	check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on checked update of packed' '
	git update-ref refs/heads/packed-checked-update $A &&
	git pack-refs --all &&
	mark_packed_refs &&
	git update-ref refs/heads/packed-checked-update $B $A &&
	check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on verify of packed' '
	git update-ref refs/heads/packed-verify $A &&
	git pack-refs --all &&
	mark_packed_refs &&
	echo "verify refs/heads/packed-verify $A" | git update-ref --stdin &&
	check_packed_refs_marked
'

test_expect_success 'touch packed-refs on delete of packed' '
	git update-ref refs/heads/packed-delete $A &&
	git pack-refs --all &&
	mark_packed_refs &&
	git update-ref -d refs/heads/packed-delete &&
	! check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on update of loose' '
	git pack-refs --all &&
	git update-ref refs/heads/loose-update $A &&
	mark_packed_refs &&
	git update-ref refs/heads/loose-update $B &&
	check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on checked update of loose' '
	git pack-refs --all &&
	git update-ref refs/heads/loose-checked-update $A &&
	mark_packed_refs &&
	git update-ref refs/heads/loose-checked-update $B $A &&
	check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on verify of loose' '
	git pack-refs --all &&
	git update-ref refs/heads/loose-verify $A &&
	mark_packed_refs &&
	echo "verify refs/heads/loose-verify $A" | git update-ref --stdin &&
	check_packed_refs_marked
'

test_expect_success 'leave packed-refs untouched on delete of loose' '
	git pack-refs --all &&
	git update-ref refs/heads/loose-delete $A &&
	mark_packed_refs &&
	git update-ref -d refs/heads/loose-delete &&
	check_packed_refs_marked
'

test_done
debug log:

solving c6f783255633 ...
found c6f783255633 in https://public-inbox.org/git/2dc73bf2ec96acae12a17c719083d11401775bc3.1618255553.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/bdb19af22cc7c4f3383f03f42cb4906c3ec5c5f3.1615580397.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/2fd7cb8c0983501e2af2f195aec81d7c17fb80e1.1618832277.git.gitgitgadget@gmail.com/
found be12fb63506e in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 be12fb63506e2a8c242e876526dbe1d60e105f49	t/t1409-avoid-packing-refs.sh

applying [1/3] https://public-inbox.org/git/2dc73bf2ec96acae12a17c719083d11401775bc3.1618255553.git.gitgitgadget@gmail.com/
diff --git a/t/t1409-avoid-packing-refs.sh b/t/t1409-avoid-packing-refs.sh
index be12fb63506e..c6f783255633 100755

Checking patch t/t1409-avoid-packing-refs.sh...
Applied patch t/t1409-avoid-packing-refs.sh cleanly.

skipping https://public-inbox.org/git/bdb19af22cc7c4f3383f03f42cb4906c3ec5c5f3.1615580397.git.gitgitgadget@gmail.com/ for c6f783255633
skipping https://public-inbox.org/git/2fd7cb8c0983501e2af2f195aec81d7c17fb80e1.1618832277.git.gitgitgadget@gmail.com/ for c6f783255633
index at:
100755 c6f7832556332778e388dcc13438acf4073851a4	t/t1409-avoid-packing-refs.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).