From: Junio C Hamano Date: Tue, 30 Oct 2018 06:43:42 +0000 (+0900) Subject: Merge branch 'tq/branch-create-wo-branch-get' X-Git-Tag: v2.20.0-rc0~121 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d4591b97bdb72d5b7c7b84c75f5a0010e44932ca?hp=-c Merge branch 'tq/branch-create-wo-branch-get' Code clean-up. * tq/branch-create-wo-branch-get: builtin/branch.c: remove useless branch_get --- d4591b97bdb72d5b7c7b84c75f5a0010e44932ca diff --combined builtin/branch.c index c396c41533,daf054598b..2367703034 --- a/builtin/branch.c +++ b/builtin/branch.c @@@ -23,7 -23,6 +23,7 @@@ #include "ref-filter.h" #include "worktree.h" #include "help.h" +#include "commit-reach.h" static const char * const builtin_branch_usage[] = { N_("git branch [] [-r | -a] [--merged | --no-merged]"), @@@ -38,6 -37,7 +38,6 @@@ static const char *head; static struct object_id head_oid; -static int used_deprecated_reflog_option; static int branch_use_color = -1; static char branch_colors[][COLOR_MAXLEN] = { @@@ -578,6 -578,14 +578,6 @@@ static int edit_branch_description(cons return 0; } -static int deprecated_reflog_option_cb(const struct option *opt, - const char *arg, int unset) -{ - used_deprecated_reflog_option = 1; - *(int *)opt->value = !unset; - return 0; -} - int cmd_branch(int argc, const char **argv, const char *prefix) { int delete = 0, rename = 0, copy = 0, force = 0, list = 0; @@@ -619,8 -627,14 +619,8 @@@ OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2), OPT_BIT('c', "copy", ©, N_("copy a branch and its reflog"), 1), OPT_BIT('C', NULL, ©, N_("copy a branch, even if target exists"), 2), - OPT_BOOL(0, "list", &list, N_("list branch names")), + OPT_BOOL('l', "list", &list, N_("list branch names")), OPT_BOOL(0, "create-reflog", &reflog, N_("create the branch's reflog")), - { - OPTION_CALLBACK, 'l', NULL, &reflog, NULL, - N_("deprecated synonym for --create-reflog"), - PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, - deprecated_reflog_option_cb - }, OPT_BOOL(0, "edit-description", &edit_description, N_("edit the description for the branch")), OPT__FORCE(&force, N_("force creation, move/rename, deletion"), PARSE_OPT_NOCOMPLETE), @@@ -693,6 -707,11 +693,6 @@@ if (list) setup_auto_pager("branch", 1); - if (used_deprecated_reflog_option && !list) { - warning("the '-l' alias for '--create-reflog' is deprecated;"); - warning("it will be removed in a future version of Git"); - } - if (delete) { if (!argc) die(_("branch name required")); @@@ -809,11 -828,6 +809,6 @@@ git_config_set_multivar(buf.buf, NULL, NULL, 1); strbuf_release(&buf); } else if (argc > 0 && argc <= 2) { - struct branch *branch = branch_get(argv[0]); - - if (!branch) - die(_("no such branch '%s'"), argv[0]); - if (filter.kind != FILTER_REFS_BRANCHES) die(_("-a and -r options to 'git branch' do not make sense with a branch name"));