path: root/archive.c
diff options
authorJunio C Hamano <>2011-09-27 23:59:01 (GMT)
committerJunio C Hamano <>2011-09-28 00:00:06 (GMT)
commitf858c646b5428519c4f847c5f15a9ead72a62b16 (patch)
tree8a8e08bbd6e3ec65531e6e057812d4c60348b0c9 /archive.c
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 <>
Diffstat (limited to 'archive.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/archive.c b/archive.c
index 3fd7f47..2ae740a 100644
--- a/archive.c
+++ b/archive.c
@@ -318,7 +318,7 @@ static int parse_archive_args(int argc, const char **argv,
"prepend prefix to each pathname in the archive"),
OPT_STRING('o', "output", &output, "file",
"write the archive to this file"),
- OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
+ OPT_BOOL(0, "worktree-attributes", &worktree_attributes,
"read .gitattributes in working directory"),
OPT__VERBOSE(&verbose, "report archived files on stderr"),
OPT__COMPR('0', &compression_level, "store only", 0),
@@ -332,7 +332,7 @@ static int parse_archive_args(int argc, const char **argv,
OPT__COMPR_HIDDEN('8', &compression_level, 8),
OPT__COMPR('9', &compression_level, "compress better", 9),
- OPT_BOOLEAN('l', "list", &list,
+ OPT_BOOL('l', "list", &list,
"list supported archive formats"),
OPT_STRING(0, "remote", &remote, "repo",