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 <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
Aug 6, 2012 at 22:01 UTC
2c3fd4bbb42b586b016319d2009a05fe5b878533
1 file changed
+35
t/t5400-send-pack.sh
+35
@@ -145,6 +145,41 @@ test_expect_success 'push --all excludes remote-tracking hierarchy' '
145
)
146
'
147
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
+
183
rewound_push_setup() {
184
rm -rf parent child &&
185
mkdir parent &&