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:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2018-10-23 01:15:05 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-23 07:18:01 +0300
commitb98e914e4650b876b9049bff1a5a33f4bfda0e0a (patch)
tree1724ad350619f1490058d149f7fb6d55ee56e281 /builtin
parent12aeb00a22e589f85e26da833e05bb1a7e412d07 (diff)
rebase (autostash): use an explicit OID to apply the stash
When `git stash apply <argument>` sees an argument that consists only of digits, it tries to be smart and interpret it as `stash@{<number>}`. Unfortunately, an all-digit hash (which is unlikely but still possible) is therefore misinterpreted as `stash@{<n>}` reflog. To prevent that from happening, let's append `^0` after the stash hash, to make sure that it is interpreted as an OID rather than as a number. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index cd6beb96b4..e9995c9a37 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -252,6 +252,8 @@ static int apply_autostash(struct rebase_options *opts)
if (read_one(path, &autostash))
return error(_("Could not read '%s'"), path);
+ /* Ensure that the hash is not mistaken for a number */
+ strbuf_addstr(&autostash, "^0");
argv_array_pushl(&stash_apply.args,
"stash", "apply", autostash.buf, NULL);
stash_apply.git_cmd = 1;