git-archive: work in bare repos
This moves the call to git_config to a place where it doesn't break the logic for using git archive in a bare repository but retains the fix to make git archive respect core.autocrlf. Tests are by René Scharfe. Signed-off-by: Charles Bailey <charles@hashpling.org> Tested-by: Deskin Miller <deskinm@umich.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charles Bailey committed
Oct 25, 2008 at 11:38 UTC
ddff8563510a2c5c675d488a02e2642306430fc1
3 files changed
+23
-2
archive.c
+2
@@ -338,5 +338,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
338
parse_treeish_arg(argv, &args, prefix);
339
parse_pathspec_arg(argv + 1, &args);
340
341
+ git_config(git_default_config, NULL);
342
+
343
return ar->write_archive(&args);
344
}
builtin-archive.c
-2
@@ -111,8 +111,6 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
111
{
112
const char *remote = NULL;
113
114
- git_config(git_default_config, NULL);
115
-
114
remote = extract_remote_arg(&argc, argv);
115
if (remote)
116
return run_remote_archiver(remote, argc, argv);
t/t5000-tar-tree.sh
+21
@@ -57,6 +57,11 @@ test_expect_success \
57
git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
58
git commit-tree $treeid </dev/null)'
59
60
+test_expect_success \
61
+ 'create bare clone' \
62
+ 'git clone --bare . bare.git &&
63
+ cp .gitattributes bare.git/info/attributes'
64
+
65
test_expect_success \
66
'remove ignored file' \
67
'rm a/ignored'
@@ -73,6 +78,14 @@ test_expect_success \
78
'git archive vs. git tar-tree' \
79
'diff b.tar b2.tar'
80
81
+test_expect_success \
82
+ 'git archive in a bare repo' \
83
+ '(cd bare.git && git archive HEAD) >b3.tar'
84
+
85
+test_expect_success \
86
+ 'git archive vs. the same in a bare repo' \
87
+ 'test_cmp b.tar b3.tar'
88
+
89
test_expect_success \
90
'validate file modification time' \
91
'mkdir extract &&
@@ -151,6 +164,14 @@ test_expect_success \
164
'git archive --format=zip' \
165
'git archive --format=zip HEAD >d.zip'
166
167
+test_expect_success \
168
+ 'git archive --format=zip in a bare repo' \
169
+ '(cd bare.git && git archive --format=zip HEAD) >d1.zip'
170
+
171
+test_expect_success \
172
+ 'git archive --format=zip vs. the same in a bare repo' \
173
+ 'test_cmp d.zip d1.zip'
174
+
175
$UNZIP -v >/dev/null 2>&1
176
if [ $? -eq 127 ]; then
177
echo "Skipping ZIP tests, because unzip was not found"