git-svn: support for git-svn propset
[gitweb.git] / t / t7701-repack-unpack-unreachable.sh
index 200ab61278643e8b9deb4f624a95378e7e4c5b67..aad8a9c64dda7c0886a40343f07411a90977a37d 100755 (executable)
@@ -95,4 +95,31 @@ test_expect_success 'unpacked objects receive timestamp of pack file' '
        compare_mtimes < mtimes
 '
 
+test_expect_success 'do not bother loosening old objects' '
+       obj1=$(echo one | git hash-object -w --stdin) &&
+       obj2=$(echo two | git hash-object -w --stdin) &&
+       pack1=$(echo $obj1 | git pack-objects .git/objects/pack/pack) &&
+       pack2=$(echo $obj2 | git pack-objects .git/objects/pack/pack) &&
+       git prune-packed &&
+       git cat-file -p $obj1 &&
+       git cat-file -p $obj2 &&
+       test-chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
+       git repack -A -d --unpack-unreachable=1.hour.ago &&
+       git cat-file -p $obj1 &&
+       test_must_fail git cat-file -p $obj2
+'
+
+test_expect_success 'keep packed objects found only in index' '
+       echo my-unique-content >file &&
+       git add file &&
+       git commit -m "make it reachable" &&
+       git gc &&
+       git reset HEAD^ &&
+       git reflog expire --expire=now --all &&
+       git add file &&
+       test-chmtime =-86400 .git/objects/pack/* &&
+       git gc --prune=1.hour.ago &&
+       git cat-file blob :file
+'
+
 test_done