{"thread":{"id":"739","subject":"[PATCH] testcase for git-tar-tree","startedAt":"2005-05-27T20:36:02Z","lastAt":"2005-05-27T20:36:02Z","messageCount":1,"participants":["Rene Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4085","messageId":"20050527203602.GA16785@lsrfire.ath.cx","threadId":"739","inReplyTo":null,"subject":"[PATCH] testcase for git-tar-tree","fromName":"Rene Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2005-05-27T20:36:02Z","receivedAt":"2005-05-27T20:36:02Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Add testcase for git-tar-tree and git-get-tar-commit-id.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n\nIndex: t/t3200-tar-tree.sh\n===================================================================\n--- /dev/null  (tree:f6db9be9d431080d9e7f61edb616b8bac8c9618f)\n+++ ba1de5878d8e0cd1c7c728379e033ea6bf8567e5/t/t3200-tar-tree.sh  (mode:100755)\n@@ -0,0 +1,106 @@\n+#!/bin/sh\n+#\n+# Copyright (C) 2005 Rene Scharfe\n+#\n+\n+test_description='git-tar-tree and git-get-tar-commit-id test\n+\n+This test covers the topics of long paths, file contents, commit date\n+handling and commit id embedding:\n+\n+  Paths longer than 100 characters require the use of a pax extended\n+  header to store them.  The test creates files with pathes both longer\n+  and shorter than 100 chars, and also checks symlinks with long and\n+  short pathes both as their own name and as target path.\n+\n+  The contents of the repository is compared to the extracted tar\n+  archive.  The repository contains simple text files, symlinks and a\n+  binary file (/bin/sh).\n+\n+  git-tar-tree applies the commit date to every file in the archive it\n+  creates.  The test sets the commit date to a specific value and checks\n+  if the tar archive contains that value.\n+\n+  When giving git-tar-tree a commit id (in contrast to a tree id) it\n+  embeds this commit id into the tar archive as a comment.  The test\n+  checks the ability of git-get-tar-commit-id to figure it out from the\n+  tar file.\n+\n+'\n+\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'populate workdir' \\\n+    'mkdir a b c &&\n+     p48=1.......10........20........30........40......48 &&\n+     p50=1.......10........20........30........40........50 &&\n+     p98=${p48}${p50} &&\n+     echo simple textfile >a/a &&\n+     echo 100 chars in path >a/${p98} &&\n+     echo 101 chars in path >a/${p98}x &&\n+     echo 102 chars in path >a/${p98}xx &&\n+     echo 103 chars in path >a/${p98}xxx &&\n+     mkdir a/bin &&\n+     cp /bin/sh a/bin/sh &&\n+     ln -s a a/l1 &&\n+     ln -s ${p98}xx a/l100 &&\n+     ln -s ${p98}xxx a/l101 &&\n+     ln -s ${p98}xxx a/l${p98} &&\n+     (cd a && find .) | sort >a.lst'\n+\n+test_expect_success \\\n+    'add files to repository' \\\n+    'find a -type f | xargs git-update-cache --add &&\n+     find a -type l | xargs git-update-cache --add &&\n+     treeid=`git-write-tree` &&\n+     echo $treeid >treeid &&\n+     TZ= GIT_COMMITTER_DATE=\"2005-05-27 22:00:00\" \\\n+     git-commit-tree $treeid </dev/null >.git/HEAD'\n+\n+test_expect_success \\\n+    'git-tar-tree' \\\n+    'git-tar-tree HEAD >b.tar'\n+\n+test_expect_success \\\n+    'validate file modification time' \\\n+    'tar tvf b.tar a/a | awk \\{print\\ \\$4,\\$5\\} >b.mtime &&\n+     echo \"2005-05-27 22:00:00\" >expected.mtime &&\n+     diff expected.mtime b.mtime'\n+\n+test_expect_success \\\n+    'git-get-tar-commit-id' \\\n+    'git-get-tar-commit-id <b.tar >b.commitid &&\n+     diff .git/HEAD b.commitid'\n+\n+test_expect_success \\\n+    'extract tar archive' \\\n+    '(cd b && tar xf -) <b.tar'\n+\n+test_expect_success \\\n+    'validate filenames' \\\n+    '(cd b/a && find .) | sort >b.lst &&\n+     diff a.lst b.lst'\n+\n+test_expect_success \\\n+    'validate file contents' \\\n+    'diff -r a b/a'\n+\n+test_expect_success \\\n+    'git-tar-tree with prefix' \\\n+    'git-tar-tree HEAD prefix >c.tar'\n+\n+test_expect_success \\\n+    'extract tar archive with prefix' \\\n+    '(cd c && tar xf -) <c.tar'\n+\n+test_expect_success \\\n+    'validate filenames with prefix' \\\n+    '(cd c/prefix/a && find .) | sort >c.lst &&\n+     diff a.lst c.lst'\n+\n+test_expect_success \\\n+    'validate file contents with prefix' \\\n+    'diff -r a c/prefix/a'\n+\n+test_done\n"}]}