diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-05 21:30:02 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-05 21:30:03 +0200 |
commit | 9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7 (patch) | |
tree | 33890dd97b16e432a06810ee92b7fd25da71dfe1 /parse-options-cb.c | |
parent | Git 2.6 (diff) | |
parent | for-each-ref: add '--contains' option (diff) | |
download | git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.tar.xz git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.zip |
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 'parse-options-cb.c')
-rw-r--r-- | parse-options-cb.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c index 5ab6ed6b08..239898d946 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -5,6 +5,7 @@ #include "color.h" #include "string-list.h" #include "argv-array.h" +#include "sha1-array.h" /*----- some often used options -----*/ @@ -77,7 +78,7 @@ int parse_opt_verbosity_cb(const struct option *opt, const char *arg, return 0; } -int parse_opt_with_commit(const struct option *opt, const char *arg, int unset) +int parse_opt_commits(const struct option *opt, const char *arg, int unset) { unsigned char sha1[20]; struct commit *commit; @@ -93,6 +94,22 @@ int parse_opt_with_commit(const struct option *opt, const char *arg, int unset) return 0; } +int parse_opt_object_name(const struct option *opt, const char *arg, int unset) +{ + unsigned char sha1[20]; + + if (unset) { + sha1_array_clear(opt->value); + return 0; + } + if (!arg) + return -1; + if (get_sha1(arg, sha1)) + return error(_("malformed object name '%s'"), arg); + sha1_array_append(opt->value, sha1); + return 0; +} + int parse_opt_tertiary(const struct option *opt, const char *arg, int unset) { int *target = opt->value; |