Skip to content

Commit

Permalink
branch --contains: default to HEAD
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jul 9, 2008
1 parent 1cc6985 commit e84fb2f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions builtin-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down

0 comments on commit e84fb2f

Please sign in to comment.