git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Pierre Habouzit" <madcoder@debian.org>
Subject: Re: [PATCH 1/5] parseopt: add OPT_NEGBIT
Date: Fri, 8 May 2009 01:01:17 -0400	[thread overview]
Message-ID: <20090508050117.GB8909@coredump.intra.peff.net> (raw)
In-Reply-To: <1241725457.4772.7.camel@ubuntu.ubuntu-domain>

On Thu, May 07, 2009 at 09:44:17PM +0200, René Scharfe wrote:

> Add OPTION_NEGBIT and OPT_NEGBIT, mirroring OPTION_BIT and OPT_BIT.
> OPT_NEGBIT can be used together with OPT_BIT to define two options
> that cancel each other out.

Nice, this neatly fixes the problem with --no-no-empty-directory in
"ls-files" discussed here:

  http://article.gmane.org/gmane.comp.version-control.git/112607

We just need this patch on top of René's 1/5:

-- >8 --
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>
---
 builtin-ls-files.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index da2daf4..3d59b0e 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -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,
-- 
1.6.3.201.g5d2a4.dirty

  reply	other threads:[~2009-05-08  5:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 19:43 [PATCH 0/5] grep parseopt conversion René Scharfe
2009-05-07 19:44 ` [PATCH 1/5] parseopt: add OPT_NEGBIT René Scharfe
2009-05-08  5:01   ` Jeff King [this message]
2009-05-07 19:45 ` [PATCH 2/5] parseopt: add OPT_NUMBER_CALLBACK René Scharfe
2009-05-07 19:45 ` [PATCH 3/5] parseopt: add PARSE_OPT_NODASH René Scharfe
2009-05-07 19:46 ` [PATCH 4/5] grep: remove global variable builtin_grep René Scharfe
2009-05-07 19:46 ` [PATCH 5/5] grep: use parseopt René Scharfe
2009-05-16  9:44   ` Stephen Boyd
2009-05-17 19:45     ` René Scharfe
2009-05-20 22:05     ` [PATCH] grep: make callback functions static René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090508050117.GB8909@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madcoder@debian.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).