Skip to content

Commit 2c3fd4b

Browse files
drafnelgitster
authored andcommitted
t/t5400: demonstrate breakage caused by informational message from prune
When receive-pack triggers 'git gc --auto' and 'git prune' is called to remove a stale temporary object, 'git prune' prints an informational message to stdout about the file that it will remove. Since this message is written to stdout, it is sent back over the transport channel to the git client which tries to interpret it as part of the pack protocol and then promptly terminates with a complaint about a protocol error. Introduce a test which exercises the auto-gc functionality of receive-pack and demonstrates this breakage. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0f1ea6 commit 2c3fd4b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

t/t5400-send-pack.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,41 @@ test_expect_success 'push --all excludes remote-tracking hierarchy' '
145145
)
146146
'
147147

148+
test_expect_failure 'receive-pack runs auto-gc in remote repo' '
149+
rm -rf parent child &&
150+
git init parent &&
151+
(
152+
# Setup a repo with 2 packs
153+
cd parent &&
154+
echo "Some text" >file.txt &&
155+
git add . &&
156+
git commit -m "Initial commit" &&
157+
git repack -adl &&
158+
echo "Some more text" >>file.txt &&
159+
git commit -a -m "Second commit" &&
160+
git repack
161+
) &&
162+
cp -a parent child &&
163+
(
164+
# Set the child to auto-pack if more than one pack exists
165+
cd child &&
166+
git config gc.autopacklimit 1 &&
167+
git branch test_auto_gc &&
168+
# And create a file that follows the temporary object naming
169+
# convention for the auto-gc to remove
170+
: >.git/objects/tmp_test_object &&
171+
test-chmtime =-1209601 .git/objects/tmp_test_object
172+
) &&
173+
(
174+
cd parent &&
175+
echo "Even more text" >>file.txt &&
176+
git commit -a -m "Third commit" &&
177+
git send-pack ../child HEAD:refs/heads/test_auto_gc >output 2>&1 &&
178+
grep "Auto packing the repository for optimum performance." output
179+
) &&
180+
test ! -e child/.git/objects/tmp_test_object
181+
'
182+
148183
rewound_push_setup() {
149184
rm -rf parent child &&
150185
mkdir parent &&

0 commit comments

Comments
 (0)