{"thread":{"id":"14206","subject":"[PATCH] t7701-repack-unpack-unreachable.sh: check timestamp of unpacked objects","startedAt":"2008-06-29T00:25:05Z","lastAt":"2008-06-29T00:25:05Z","messageCount":1,"participants":["drafnel@gmail.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"81589","messageId":"4866d5bb.0807c00a.5c4b.ffffe4d7@mx.google.com","threadId":"14206","inReplyTo":null,"subject":"[PATCH] t7701-repack-unpack-unreachable.sh: check timestamp of unpacked objects","fromName":"","fromEmail":"drafnel@gmail.com","sentAt":"2008-06-29T00:25:05Z","receivedAt":"2008-06-29T00:25:05Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nUnpacked objects should receive the timestamp of the pack they were\nunpacked from. Check.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n t/t7701-repack-unpack-unreachable.sh |   34 ++++++++++++++++++++++++++++++++++\n 1 files changed, 34 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh\nindex 6a5211f..63485c1 100755\n--- a/t/t7701-repack-unpack-unreachable.sh\n+++ b/t/t7701-repack-unpack-unreachable.sh\n@@ -4,6 +4,10 @@ test_description='git-repack works correctly'\n \n . ./test-lib.sh\n \n+fsha1=\n+csha1=\n+tsha1=\n+\n test_expect_success '-A option leaves unreachable objects unpacked' '\n \techo content > file1 &&\n \tgit add . &&\n@@ -44,4 +48,34 @@ test_expect_success '-A option leaves unreachable objects unpacked' '\n \tgit show $tsha1\n '\n \n+compare_mtimes ()\n+{\n+\tperl -e 'my $reference = shift;\n+\t\t foreach my $file (@ARGV) {\n+\t\t\texit(1) unless(-f $file && -M $file == -M $reference);\n+\t\t }\n+\t\t exit(0);\n+\t\t' -- \"$@\"\n+}\n+\n+test_expect_success 'unpacked objects receive timestamp of pack file' '\n+\tfsha1path=$(echo \"$fsha1\" | sed -e \"s/\\(..\\)\\(.*\\)/\\1\\/\\2/\") &&\n+\tfsha1path=\".git/objects/$fsha1path\" &&\n+\tcsha1path=$(echo \"$csha1\" | sed -e \"s/\\(..\\)\\(.*\\)/\\1\\/\\2/\") &&\n+\tcsha1path=\".git/objects/$csha1path\" &&\n+\ttsha1path=$(echo \"$tsha1\" | sed -e \"s/\\(..\\)\\(.*\\)/\\1\\/\\2/\") &&\n+\ttsha1path=\".git/objects/$tsha1path\" &&\n+\tgit branch transient_branch $csha1 &&\n+\tgit repack -a -d -l &&\n+\ttest ! -f \"$fsha1path\" &&\n+\ttest ! -f \"$csha1path\" &&\n+\ttest ! -f \"$tsha1path\" &&\n+\ttest 1 = $(ls -1 .git/objects/pack/pack-*.pack | wc -l) &&\n+\tpackfile=$(ls .git/objects/pack/pack-*.pack) &&\n+\tgit branch -D transient_branch &&\n+\tsleep 1 &&\n+\tgit repack -A -l &&\n+\tcompare_mtimes \"$packfile\" \"$fsha1path\" \"$csha1path\" \"$tsha1path\"\n+'\n+\n test_done\n-- \n1.5.6.1\n"}]}