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] = {
(reference_name = reference_name_to_free =
resolve_refdup(upstream, RESOLVE_REF_READING,
&oid, NULL)) != NULL)
- reference_rev = lookup_commit_reference(&oid);
+ reference_rev = lookup_commit_reference(the_repository,
+ &oid);
}
if (!reference_rev)
reference_rev = head_rev;
const struct object_id *oid, struct commit *head_rev,
int kinds, int force)
{
- struct commit *rev = lookup_commit_reference(oid);
+ struct commit *rev = lookup_commit_reference(the_repository, oid);
if (!rev) {
error(_("Couldn't look up commit object for '%s'"), refname);
return -1;
}
if (!force) {
- head_rev = lookup_commit_reference(&head_oid);
+ head_rev = lookup_commit_reference(the_repository, &head_oid);
if (!head_rev)
die(_("Couldn't look up commit object for HEAD"));
}
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;
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),
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"));