summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-22 00:19:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-22 00:19:25 (GMT)
commite660e11b202f12d15cfe8089909a307b1900c03a (patch)
tree7717a73e5920d4e3a5482391e5e290a220ba2d6b /t
parente8760cde01299817daae26c9ad074b776bbd8f88 (diff)
parentb9849a1ab63143c3b70e339491a897ef62a4173b (diff)
downloadgit-e660e11b202f12d15cfe8089909a307b1900c03a.zip
git-e660e11b202f12d15cfe8089909a307b1900c03a.tar.gz
git-e660e11b202f12d15cfe8089909a307b1900c03a.tar.bz2
Merge branch 'jc/quickfetch'
* jc/quickfetch: Make sure quickfetch is not fooled with a previous, incomplete fetch. git-fetch: use fetch--tool pick-rref to avoid local fetch from alternate git-fetch--tool pick-rref
Diffstat (limited to 't')
-rwxr-xr-xt/t5502-quickfetch.sh89
1 files changed, 89 insertions, 0 deletions
diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh
new file mode 100755
index 0000000..b4760f2
--- /dev/null
+++ b/t/t5502-quickfetch.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+test_description='test quickfetch from local'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+ test_tick &&
+ echo ichi >file &&
+ git add file &&
+ git commit -m initial &&
+
+ cnt=$( (
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 3
+'
+
+test_expect_success 'clone without alternate' '
+
+ (
+ mkdir cloned &&
+ cd cloned &&
+ git init-db &&
+ git remote add -f origin ..
+ ) &&
+ cnt=$( (
+ cd cloned &&
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 3
+'
+
+test_expect_success 'further commits in the original' '
+
+ test_tick &&
+ echo ni >file &&
+ git commit -a -m second &&
+
+ cnt=$( (
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 6
+'
+
+test_expect_success 'copy commit and tree but not blob by hand' '
+
+ git rev-list --objects HEAD |
+ git pack-objects --stdout |
+ (
+ cd cloned &&
+ git unpack-objects
+ ) &&
+
+ cnt=$( (
+ cd cloned &&
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 6
+
+ blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
+ test -f "cloned/.git/objects/$blob" &&
+ rm -f "cloned/.git/objects/$blob" &&
+
+ cnt=$( (
+ cd cloned &&
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 5
+
+'
+
+test_expect_success 'quickfetch should not leave a corrupted repository' '
+
+ (
+ cd cloned &&
+ git fetch
+ ) &&
+
+ cnt=$( (
+ cd cloned &&
+ git count-objects | sed -e "s/ *objects,.*//"
+ ) ) &&
+ test $cnt -eq 6
+
+'
+
+test_done