0f686d2199acb88cc743b6720e815984dfe7fce1
   1#!/bin/sh
   2test_description='test git fast-import unpack limit'
   3. ./test-lib.sh
   4
   5test_expect_success 'create loose objects on import' '
   6        test_tick &&
   7        cat >input <<-INPUT_END &&
   8        commit refs/heads/master
   9        committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
  10        data <<COMMIT
  11        initial
  12        COMMIT
  13
  14        done
  15        INPUT_END
  16
  17        git -c fastimport.unpackLimit=2 fast-import --done <input &&
  18        git fsck --no-progress &&
  19        test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
  20        test $(find .git/objects/pack -type f | wc -l) -eq 0
  21'
  22
  23test_expect_success 'bigger packs are preserved' '
  24        test_tick &&
  25        cat >input <<-INPUT_END &&
  26        commit refs/heads/master
  27        committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
  28        data <<COMMIT
  29        incremental should create a pack
  30        COMMIT
  31        from refs/heads/master^0
  32
  33        commit refs/heads/branch
  34        committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
  35        data <<COMMIT
  36        branch
  37        COMMIT
  38
  39        done
  40        INPUT_END
  41
  42        git -c fastimport.unpackLimit=2 fast-import --done <input &&
  43        git fsck --no-progress &&
  44        test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
  45        test $(find .git/objects/pack -type f | wc -l) -eq 2
  46'
  47
  48test_done