Imported Upstream version 2.13.4
[platform/upstream/git.git] / t / t5300-pack-object.sh
index fc2be63..43a672c 100755 (executable)
@@ -284,6 +284,12 @@ test_expect_success \
      git index-pack test-3.pack &&
      cmp test-3.idx test-3-${packname_3}.idx &&
 
+     cat test-1-${packname_1}.pack >test-4.pack &&
+     rm -f test-4.keep &&
+     git index-pack --keep=why test-4.pack &&
+     cmp test-1-${packname_1}.idx test-4.idx &&
+     test -f test-4.keep &&
+
      :'
 
 test_expect_success 'unpacking with --strict' '
@@ -400,6 +406,21 @@ test_expect_success 'verify resulting packs' '
        git verify-pack test-11-*.pack
 '
 
+test_expect_success 'set up pack for non-repo tests' '
+       # make sure we have a pack with no matching index file
+       cp test-1-*.pack foo.pack
+'
+
+test_expect_success 'index-pack --stdin complains of non-repo' '
+       nongit test_must_fail git index-pack --stdin <foo.pack &&
+       test_path_is_missing non-repo/.git
+'
+
+test_expect_success 'index-pack <pack> works in non-repo' '
+       nongit git index-pack ../foo.pack &&
+       test_path_is_file foo.idx
+'
+
 #
 # WARNING!
 #