diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-01-31 18:07:59 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-31 18:07:59 -0800 |
commit | b37f26d8a2d4551b8ee365e66cbaf3d03b05e74d (patch) | |
tree | c0cbe3de06f95fd4f799d938a8b59b23ffb1e70d /parse-options.c | |
parent | 29254142ddac335b33606c0036561f6df89f3d18 (diff) | |
parent | 32c35cfb1e9c8523b9d60e5095f1c49ebaef0279 (diff) | |
download | git-b37f26d8a2d4551b8ee365e66cbaf3d03b05e74d.tar.gz |
Merge branch 'jg/tag-contains'
* jg/tag-contains:
git-tag: Add --contains option
Make has_commit() non-static
Make opt_parse_with_commit() non-static
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c index 9eb55cc8b5..4c5d09dd25 100644 --- a/parse-options.c +++ b/parse-options.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "parse-options.h" #include "cache.h" +#include "commit.h" #define OPT_SHORT 1 #define OPT_UNSET 2 @@ -506,6 +507,22 @@ 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) +{ + unsigned char sha1[20]; + struct commit *commit; + + if (!arg) + return -1; + if (get_sha1(arg, sha1)) + return error("malformed object name %s", arg); + commit = lookup_commit_reference(sha1); + if (!commit) + return error("no such commit %s", arg); + commit_list_insert(commit, opt->value); + return 0; +} + /* * This should really be OPTION_FILENAME type as a part of * parse_options that take prefix to do this while parsing. |