Code

Ensure git-repack -a -d --max-pack-size=N deletes correct packs
[git.git] / t / t5500-fetch-pack.sh
index f7625a6f4634da4b78c90defdc0a302c8ea4e231..48e3d1705f5e4bc7f206692276b4e3e1fe1ddf66 100755 (executable)
@@ -63,13 +63,13 @@ pull_to_client () {
        case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac
        git-symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'`
 
-       test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1'
+       test_expect_success "fsck" 'git-fsck --full > fsck.txt 2>&1'
 
        test_expect_success 'check downloaded results' \
        'mv .git/objects/pack/pack-* . &&
         p=`ls -1 pack-*.pack` &&
         git-unpack-objects <$p &&
-        git-fsck-objects --full'
+        git-fsck --full'
 
        test_expect_success "new object count after $number pull" \
        'idx=`echo pack-*.idx` &&
@@ -97,7 +97,8 @@ pull_to_client () {
 (
        mkdir client &&
        cd client &&
-       git-init-db 2>> log2.txt
+       git-init 2>> log2.txt &&
+       git config transfer.unpacklimit 0
 )
 
 add A1
@@ -128,4 +129,54 @@ pull_to_client 2nd "B" $((64*3))
 
 pull_to_client 3rd "A" $((1*3)) # old fails
 
+test_expect_success "clone shallow" "git-clone --depth 2 . shallow"
+
+(cd shallow; git-count-objects -v) > count.shallow
+
+test_expect_success "clone shallow object count" \
+       "test \"in-pack: 18\" = \"$(grep in-pack count.shallow)\""
+
+count_output () {
+       sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/: 0$/d' "$1"
+}
+
+test_expect_success "clone shallow object count (part 2)" '
+       test -z "$(count_output count.shallow)"
+'
+
+test_expect_success "fsck in shallow repo" \
+       "(cd shallow; git-fsck --full)"
+
+#test_done; exit
+
+add B66 $B65
+add B67 $B66
+
+test_expect_success "pull in shallow repo" \
+       "(cd shallow; git pull .. B)"
+
+(cd shallow; git-count-objects -v) > count.shallow
+test_expect_success "clone shallow object count" \
+       "test \"count: 6\" = \"$(grep count count.shallow)\""
+
+add B68 $B67
+add B69 $B68
+
+test_expect_success "deepening pull in shallow repo" \
+       "(cd shallow; git pull --depth 4 .. B)"
+
+(cd shallow; git-count-objects -v) > count.shallow
+test_expect_success "clone shallow object count" \
+       "test \"count: 12\" = \"$(grep count count.shallow)\""
+
+test_expect_success "deepening fetch in shallow repo" \
+       "(cd shallow; git fetch --depth 4 .. A:A)"
+
+(cd shallow; git-count-objects -v) > count.shallow
+test_expect_success "clone shallow object count" \
+       "test \"count: 18\" = \"$(grep count count.shallow)\""
+
+test_expect_failure "pull in shallow repo with missing merge base" \
+       "(cd shallow; git pull --depth 4 .. A)"
+
 test_done