Subject: [WIP PATCH 15/26] archive: move up gitdir setup to run_builtin()

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Tue, 16 Feb 2010 23:05:06 +0700

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 builtin-archive.c       |    2 +-
 git.c                   |    4 ++--
 t/t0024-crlf-archive.sh |    3 +++
 t/t5000-tar-tree.sh     |    2 ++
 t/t5001-archive-attr.sh |    2 ++
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/builtin-archive.c b/builtin-archive.c
index 6a887f5..ef0bef8 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -125,5 +125,5 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
 
 	setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
 
-	return write_archive(argc, argv, prefix, 1);
+	return write_archive(argc, argv, prefix, 0);
 }
diff --git a/git.c b/git.c
index 1d1ad1a..24fc0fc 100644
--- a/git.c
+++ b/git.c
@@ -308,7 +308,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
 		{ "annotate", cmd_annotate, RUN_SETUP },
 		{ "apply", cmd_apply },
-		{ "archive", cmd_archive },
+		{ "archive", cmd_archive, RUN_SETUP_GENTLY },
 		{ "bisect--helper", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE },
 		{ "blame", cmd_blame, RUN_SETUP },
 		{ "branch", cmd_branch, RUN_SETUP },
@@ -396,7 +396,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "stripspace", cmd_stripspace },
 		{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
 		{ "tag", cmd_tag, RUN_SETUP },
-		{ "tar-tree", cmd_tar_tree },
+		{ "tar-tree", cmd_tar_tree, RUN_SETUP_GENTLY },
 		{ "unpack-file", cmd_unpack_file, RUN_SETUP },
 		{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
 		{ "update-index", cmd_update_index, RUN_SETUP },
diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index c7d0324..f96db4d 100755
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -3,6 +3,9 @@
 test_description='respect crlf in git archive'
 
 . ./test-lib.sh
+
+export GIT_HARDENED_SETUP=1
+
 UNZIP=${UNZIP:-unzip}
 
 test_expect_success setup '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 27bfba5..4c69dd2 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -29,6 +29,8 @@ UNZIP=${UNZIP:-unzip}
 
 SUBSTFORMAT=%H%n
 
+export GIT_HARDENED_SETUP=1
+
 test_expect_success \
     'populate workdir' \
     'mkdir a b c &&
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 426b319..80e1e72 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -4,6 +4,8 @@ test_description='git archive attribute tests'
 
 . ./test-lib.sh
 
+export GIT_HARDENED_SETUP=1
+
 SUBSTFORMAT=%H%n
 
 test_expect_exists() {
-- 
1.7.0.195.g637a2