Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 22, 2018, 22:25 UTC
- Message-ID
- <CAPig+cSgRttNJTScnYaE6G2kgpFzwYMnroH=bCKtc0a2Y5CiBQ@mail.gmail.com>
- In-Reply-To
- <07140a71dd9ed3f709970f0ce5eb6aa014417b25.1540246499.git.gitgitgadget@gmail.com>
On Mon, Oct 22, 2018 at 6:15 PM Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 17 quoted lines
> 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>
> ---
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> @@ -253,6 +253,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 mistake for a number */s/mistake/mistaken/