Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-01-01 02:55:12 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-05 02:24:13 +0300
commitca5120c339de883c3f22161316416c91655651ab (patch)
treed7f6ec3064bfcef21becfb2e21d619aa669a7c5b /builtin/rebase.c
parent898f80736c75878acc02dc55672317fcc0e0a5a6 (diff)
rebase: verify commit parameter
If the user specifies a base commit to switch to, check if it actually references a commit right away to avoid getting confused later on when it turns out to be an invalid object. Reported-by: LeSeulArtichaut <leseulartichaut@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index eeca53382f..d0f112ffc2 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1906,7 +1906,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'"),