Code

parseopt: add OPT_NEGBIT
authorJeff King <peff@peff.net>
Fri, 8 May 2009 05:01:17 +0000 (01:01 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 9 May 2009 07:29:07 +0000 (00:29 -0700)
On Thu, May 07, 2009 at 09:44:17PM +0200, RenĂ© Scharfe wrote:
Subject: [PATCH] ls-files: make --no-empty-directory properly negatable

This option was specified to parseopt as an OPT_BIT; however, we
actually want to _set_ the bit on --no-empty-directory. Thus the
existing implementation used --no-empty-directory, and required
--no-no-empty-directory to negate it.

Now that OPT_NEGBIT exists, we can properly support it as
--empty-directory and --no-empty-directory (but of course
still defaulting to showing empty directories).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-ls-files.c

index da2daf45acd2154b7f00da34d41a5ab8acaf0c38..3d59b0e140ca199997704ffcf59fbc2138345168 100644 (file)
@@ -454,7 +454,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
                OPT_BIT(0, "directory", &dir.flags,
                        "show 'other' directories' name only",
                        DIR_SHOW_OTHER_DIRECTORIES),
-               OPT_BIT(0, "no-empty-directory", &dir.flags,
+               OPT_NEGBIT(0, "empty-directory", &dir.flags,
                        "don't show empty directories",
                        DIR_HIDE_EMPTY_DIRECTORIES),
                OPT_BOOLEAN('u', "unmerged", &show_unmerged,