summaryrefslogtreecommitdiff
path: root/t/t5400-send-pack.sh
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2012-08-07 05:01:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-08-07 05:29:30 (GMT)
commit2c3fd4bbb42b586b016319d2009a05fe5b878533 (patch)
tree281126b364e0b8c392afc5968e72dddf100e6fc3 /t/t5400-send-pack.sh
parentd0f1ea6003d97e63110fa7d50bb07f546a909b6e (diff)
downloadgit-2c3fd4bbb42b586b016319d2009a05fe5b878533.zip
git-2c3fd4bbb42b586b016319d2009a05fe5b878533.tar.gz
git-2c3fd4bbb42b586b016319d2009a05fe5b878533.tar.bz2
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>
Diffstat (limited to 't/t5400-send-pack.sh')
-rwxr-xr-xt/t5400-send-pack.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 0eace37..04a8791 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -145,6 +145,41 @@ test_expect_success 'push --all excludes remote-tracking hierarchy' '
)
'
+test_expect_failure 'receive-pack runs auto-gc in remote repo' '
+ rm -rf parent child &&
+ git init parent &&
+ (
+ # Setup a repo with 2 packs
+ cd parent &&
+ echo "Some text" >file.txt &&
+ git add . &&
+ git commit -m "Initial commit" &&
+ git repack -adl &&
+ echo "Some more text" >>file.txt &&
+ git commit -a -m "Second commit" &&
+ git repack
+ ) &&
+ cp -a parent child &&
+ (
+ # Set the child to auto-pack if more than one pack exists
+ cd child &&
+ git config gc.autopacklimit 1 &&
+ git branch test_auto_gc &&
+ # And create a file that follows the temporary object naming
+ # convention for the auto-gc to remove
+ : >.git/objects/tmp_test_object &&
+ test-chmtime =-1209601 .git/objects/tmp_test_object
+ ) &&
+ (
+ cd parent &&
+ echo "Even more text" >>file.txt &&
+ git commit -a -m "Third commit" &&
+ git send-pack ../child HEAD:refs/heads/test_auto_gc >output 2>&1 &&
+ grep "Auto packing the repository for optimum performance." output
+ ) &&
+ test ! -e child/.git/objects/tmp_test_object
+'
+
rewound_push_setup() {
rm -rf parent child &&
mkdir parent &&