summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-02-05 16:31:22 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-02-05 16:31:22 -0800
commita08832f16e56207b2967b51c236f24e180a70107 (patch)
tree7bd4933e0b98b8ae99bc3b76e68ed7dd7d571ea5
parentMerge branch 'pb/doc-modules-git-work-tree-typofix' into maint (diff)
parentrebase: verify commit parameter (diff)
downloadtgif-a08832f16e56207b2967b51c236f24e180a70107.tar.xz
Merge branch 'rs/rebase-commit-validation' into maint
Diagnose command line error of "git rebase" early. * rs/rebase-commit-validation: rebase: verify commit parameter
-rw-r--r--builtin/rebase.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 19c7b377aa..840dbd7eb7 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1917,7 +1917,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die_if_checked_out(buf.buf, 1);
options.head_name = xstrdup(buf.buf);
/* If not is it a valid ref (branch or commit)? */
- } else if (!get_oid(branch_name, &options.orig_head))
+ } else if (!get_oid(branch_name, &options.orig_head) &&
+ lookup_commit_reference(the_repository,
+ &options.orig_head))
options.head_name = NULL;
else
die(_("fatal: no such branch/commit '%s'"),