diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2015-07-07 21:36:15 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 10:25:28 -0700 |
commit | f266c9163b34ec55e453d27e1ed246d67ee3ced0 (patch) | |
tree | 5f6e5b518280198ee1077d5aac0ca7892e82b89e /builtin/branch.c | |
parent | 9d306b5a6077f026291df3c4a5968eaf95a92417 (diff) | |
download | git-f266c9163b34ec55e453d27e1ed246d67ee3ced0.tar.gz |
parse-options.h: add macros for '--contains' option
Add a macro for using the '--contains' option in parse-options.h
also include an optional '--with' option macro which performs the
same action as '--contains'.
Make tag.c and branch.c use this new macro.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/branch.c')
-rw-r--r-- | builtin/branch.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/builtin/branch.c b/builtin/branch.c index ae9a0ebc66..c443cd8251 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -828,18 +828,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_commits, (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_commits, (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:")), |