Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-28 03:59:01 +0400
committerJunio C Hamano <gitster@pobox.com>2011-09-28 04:00:06 +0400
commitf858c646b5428519c4f847c5f15a9ead72a62b16 (patch)
tree8a8e08bbd6e3ec65531e6e057812d4c60348b0c9 /t/t5001-archive-attr.sh
parentb04ba2bb42957f63567f530e092385f085b25e63 (diff)
archive.c: use OPT_BOOL()
The list variable (which is OPT_BOOLEAN) is initialized to 0 and only checked against 0 in the code, so it is safe to use OPT_BOOL(). The worktree_attributes variable (which is OPT_BOOLEAN) is initialized to 0 and later assigned to a field with the same name in struct archive_args, which is a bitfield of width 1. It is safe and even more correct to use OPT_BOOL() here; the new test in 5001 demonstrates why using OPT_COUNTUP is wrong. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5001-archive-attr.sh')
-rwxr-xr-xt/t5001-archive-attr.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 02d4d2284d..f47d8717fd 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -57,6 +57,15 @@ test_expect_missing worktree/ignored
test_expect_exists worktree/ignored-by-tree
test_expect_missing worktree/ignored-by-worktree
+test_expect_success 'git archive --worktree-attributes option' '
+ git archive --worktree-attributes --worktree-attributes HEAD >worktree.tar &&
+ (mkdir worktree2 && cd worktree2 && "$TAR" xf -) <worktree.tar
+'
+
+test_expect_missing worktree2/ignored
+test_expect_exists worktree2/ignored-by-tree
+test_expect_missing worktree2/ignored-by-worktree
+
test_expect_success 'git archive vs. bare' '
(cd bare && git archive HEAD) >bare-archive.tar &&
test_cmp archive.tar bare-archive.tar