summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-branch.txt3
-rw-r--r--builtin/branch.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index b3084c99c1..b959df1cbf 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -91,7 +91,6 @@ OPTIONS
-D::
Shortcut for `--delete --force`.
--l::
--create-reflog::
Create the branch's reflog. This activates recording of
all changes made to the branch ref, enabling use of date
@@ -101,6 +100,8 @@ OPTIONS
The negated form `--no-create-reflog` only overrides an earlier
`--create-reflog`, but currently does not negate the setting of
`core.logAllRefUpdates`.
++
+The `-l` option is a deprecated synonym for `--create-reflog`.
-f::
--force::
diff --git a/builtin/branch.c b/builtin/branch.c
index 6d0cea9d4b..e50a5a1680 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -570,6 +570,15 @@ static int edit_branch_description(const char *branch_name)
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 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
OPT_BIT('C', NULL, &copy, 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),