From: Junio C Hamano <gitster@pobox.com>
To: Pierre Habouzit <madcoder@debian.org>
Cc: git@vger.kernel.org, Lars Hjemli <hjemli@gmail.com>
Subject: [PATCH 1/2] branch --contains: default to HEAD
Date: Tue, 08 Jul 2008 18:17:32 -0700 [thread overview]
Message-ID: <7vr6a3onyr.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vvdzfoo1s.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 08 Jul 2008 18:15:43 -0700")
We used to require the name of the commit to limit the branches shown to
the --contains option, but more recent --merged/--no-meregd defaults to
HEAD (and they do not allow arbitrary commit, which is a separate issue).
This teaches --contains to default to HEAD when no parameter is given.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This comes on top of the FAKELASTARG patch
builtin-branch.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index d279702..375e5e0 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -438,13 +438,17 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN( 0 , "color", &branch_use_color, "use colored output"),
OPT_SET_INT('r', NULL, &kinds, "act on remote-tracking branches",
REF_REMOTE_BRANCH),
- OPT_CALLBACK(0, "contains", &with_commit, "commit",
- "print only branches that contain the commit",
- opt_parse_with_commit),
+ {
+ OPTION_CALLBACK, 0, "contains", &with_commit, "commit",
+ "print only branches that contain the commit",
+ PARSE_OPT_FAKELASTARG,
+ opt_parse_with_commit, (intptr_t)"HEAD",
+ },
{
OPTION_CALLBACK, 0, "with", &with_commit, "commit",
"print only branches that contain the commit",
- PARSE_OPT_HIDDEN, opt_parse_with_commit,
+ PARSE_OPT_HIDDEN | PARSE_OPT_FAKELASTARG,
+ opt_parse_with_commit, (intptr_t) "HEAD",
},
OPT__ABBREV(&abbrev),
--
1.5.6.2.255.gbed62
next prev parent reply other threads:[~2008-07-09 1:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 6:49 What should "git branch --merged master" do? Junio C Hamano
2008-07-08 10:14 ` Pierre Habouzit
2008-07-08 10:34 ` [PATCH] parse-options: add PARSE_OPT_FAKELASTARG flag Pierre Habouzit
2008-07-09 1:15 ` Junio C Hamano
2008-07-09 1:17 ` Junio C Hamano [this message]
2008-07-09 1:22 ` [PATCH 2/2] branch --merged/--not-merged: allow specifying arbitrary commit Junio C Hamano
2008-07-09 7:45 ` Pierre Habouzit
2008-07-09 9:13 ` Junio C Hamano
2008-07-09 7:47 ` [PATCH] parse-options: add PARSE_OPT_FAKELASTARG flag Pierre Habouzit
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=7vr6a3onyr.fsf_-_@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hjemli@gmail.com \
--cc=madcoder@debian.org \
/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).