summaryrefslogtreecommitdiff
path: root/builtin-branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-08 17:31:51 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-09 01:37:34 -0700
commite84fb2ff75f861a708ea5a914883e178a845f4ef (patch)
treea60acd0399d2bdc57ea860cfbfba65010d340923 /builtin-branch.c
parent1cc6985ca7dd3aaab0617ec0fd00d4eb0b424465 (diff)
downloadgit-e84fb2ff75f861a708ea5a914883e178a845f4ef.tar.gz
branch --contains: default to HEAD
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>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r--builtin-branch.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/builtin-branch.c b/builtin-branch.c
index d279702ba9..50cbc9c81a 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_LASTARG_DEFAULT,
+ 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_LASTARG_DEFAULT,
+ opt_parse_with_commit, (intptr_t) "HEAD",
},
OPT__ABBREV(&abbrev),