Re: [PATCH] git stash: Give friendlier error when there is nothing to apply
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Aug 11, 2009, 12:09 UTC
- Message-ID
- <200908111409.04506.trast@student.ethz.ch>
- In-Reply-To
- <4a81559c.05ae660a.591b.010b@mx.google.com>
Ori Avtalion wrote:
Show 7 quoted lines
> apply_stash () {
> + have_stash || die 'Nothing to apply'
> +
> git update-index -q --refresh &&
> git diff-files --quiet --ignore-submodules ||
> die 'Cannot apply to a dirty working tree, please stage your changes'
> This needs a guard against the case where the user says
git stash apply $some_sha1
but his refs/stash is empty. This could be the case, e.g., after mistakenly blowing away the reflog with 'git stash clear' and then going on a recovery hunt through the unreferenced commits.
--
Thomas Rast
trast@{inf,student}.ethz.ch