diff options
author | Jake Goulding <goulding@vivisimo.com> | 2009-01-26 09:13:23 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-28 11:32:27 -0800 |
commit | 269defdf30a4beb48f230e36f20d00ee40348ab6 (patch) | |
tree | 466b46fb3c837863969c49eed07017184e16ef78 /builtin-branch.c | |
parent | 98ef23b3b106ef8cf4dc0db34e62a39e044cf99b (diff) | |
download | git-269defdf30a4beb48f230e36f20d00ee40348ab6.tar.gz git-269defdf30a4beb48f230e36f20d00ee40348ab6.tar.xz |
Make opt_parse_with_commit() non-static
Moving opt_parse_with_commit() from branch to a common location, in
preparation for using it in tag. Rename it to match naming convention
of other option parsing functions.
Signed-off-by: Jake Goulding <goulding@vivisimo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r-- | builtin-branch.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/builtin-branch.c b/builtin-branch.c index 02fa38fd3..82d6fb27c 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -466,22 +466,6 @@ static void rename_branch(const char *oldname, const char *newname, int force) strbuf_release(&newsection); } -static int opt_parse_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)) - die("malformed object name %s", arg); - commit = lookup_commit_reference(sha1); - if (!commit) - die("no such commit %s", arg); - commit_list_insert(commit, opt->value); - return 0; -} - static int opt_parse_merge_filter(const struct option *opt, const char *arg, int unset) { merge_filter = ((opt->long_name[0] == 'n') @@ -517,13 +501,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix) 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", + parse_opt_with_commit, (intptr_t)"HEAD", }, { OPTION_CALLBACK, 0, "with", &with_commit, "commit", "print only branches that contain the commit", PARSE_OPT_HIDDEN | PARSE_OPT_LASTARG_DEFAULT, - opt_parse_with_commit, (intptr_t) "HEAD", + parse_opt_with_commit, (intptr_t) "HEAD", }, OPT__ABBREV(&abbrev), |