From: Junio C Hamano Date: Fri, 30 Mar 2018 01:27:25 +0000 (-0700) Subject: Merge branch 'jk/branch-l-0-deprecation' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/552cef79136f3056aab0bd88f243f05ff294e7f0?hp=-c Merge branch 'jk/branch-l-0-deprecation' into next The "-l" option in "git branch -l" is an unfortunate short-hand for "--create-reflog", but many users, both old and new, somehow expect it to be something else, perhaps "--list". This step deprecates the short-hand and warns about the future removal of the it when it is used. * jk/branch-l-0-deprecation: branch: deprecate "-l" option t: switch "branch -l" to "branch --create-reflog" t3200: unset core.logallrefupdates when testing reflog creation --- 552cef79136f3056aab0bd88f243f05ff294e7f0 diff --combined builtin/branch.c index 5bd2a0dd48,e50a5a1680..0ac5e831f0 --- a/builtin/branch.c +++ b/builtin/branch.c @@@ -273,7 -273,7 +273,7 @@@ static int delete_branches(int argc, co bname.buf, (flags & REF_ISBROKEN) ? "broken" : (flags & REF_ISSYMREF) ? target - : find_unique_abbrev(oid.hash, DEFAULT_ABBREV)); + : find_unique_abbrev(&oid, DEFAULT_ABBREV)); } delete_branch_config(bname.buf); @@@ -570,6 -570,15 +570,15 @@@ static int edit_branch_description(cons return 0; } + static int deprecated_reflog_option_cb(const struct option *opt, + const char *arg, int unset) + { + warning("the '-l' alias for '--create-reflog' is deprecated;"); + warning("it will be removed in a future version of Git"); + *(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; @@@ -612,7 -621,13 +621,13 @@@ 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', "create-reflog", &reflog, N_("create the branch's reflog")), + 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),