summaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-05 19:30:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-05 19:30:03 (GMT)
commit9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7 (patch)
tree33890dd97b16e432a06810ee92b7fd25da71dfe1 /builtin/branch.c
parentbe08dee9738eaaa0423885ed189c2b6ad8368cf0 (diff)
parent4a71109aa442ba1a7045d36f6b148113c95ffc48 (diff)
downloadgit-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.zip
git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.tar.gz
git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.tar.bz2
Merge branch 'kn/for-each-tag-branch'
Some features from "git tag -l" and "git branch -l" have been made available to "git for-each-ref" so that eventually the unified implementation can be shared across all three, in a follow-up series or two. * kn/for-each-tag-branch: for-each-ref: add '--contains' option ref-filter: implement '--contains' option parse-options.h: add macros for '--contains' option parse-option: rename parse_opt_with_commit() for-each-ref: add '--merged' and '--no-merged' options ref-filter: implement '--merged' and '--no-merged' options ref-filter: add parse_opt_merge_filter() for-each-ref: add '--points-at' option ref-filter: implement '--points-at' option tag: libify parse_opt_points_at() t6302: for-each-ref tests for ref-filter APIs
Diffstat (limited to 'builtin/branch.c')
-rw-r--r--builtin/branch.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index ff05869..3ba4d1b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -636,6 +636,10 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
cb.pattern = pattern;
cb.ret = 0;
for_each_rawref(append_ref, &cb);
+ /*
+ * The following implementation is currently duplicated in ref-filter. It
+ * will eventually be removed when we port branch.c to use ref-filter APIs.
+ */
if (merge_filter != NO_FILTER) {
struct commit *filter;
filter = lookup_commit_reference_gently(merge_filter_ref, 0);
@@ -746,6 +750,10 @@ static void rename_branch(const char *oldname, const char *newname, int force)
strbuf_release(&newsection);
}
+/*
+ * This function is duplicated in ref-filter. It will eventually be removed
+ * when we port branch.c to use ref-filter APIs.
+ */
static int opt_parse_merge_filter(const struct option *opt, const char *arg, int unset)
{
merge_filter = ((opt->long_name[0] == 'n')
@@ -821,18 +829,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT__COLOR(&branch_use_color, N_("use colored output")),
OPT_SET_INT('r', "remotes", &kinds, N_("act on remote-tracking branches"),
REF_REMOTE_BRANCH),
- {
- OPTION_CALLBACK, 0, "contains", &with_commit, N_("commit"),
- N_("print only branches that contain the commit"),
- PARSE_OPT_LASTARG_DEFAULT,
- parse_opt_with_commit, (intptr_t)"HEAD",
- },
- {
- OPTION_CALLBACK, 0, "with", &with_commit, N_("commit"),
- N_("print only branches that contain the commit"),
- PARSE_OPT_HIDDEN | PARSE_OPT_LASTARG_DEFAULT,
- parse_opt_with_commit, (intptr_t) "HEAD",
- },
+ OPT_CONTAINS(&with_commit, N_("print only branches that contain the commit")),
+ OPT_WITH(&with_commit, N_("print only branches that contain the commit")),
OPT__ABBREV(&abbrev),
OPT_GROUP(N_("Specific git-branch actions:")),