[PATCH] git stash: Give friendlier error when there is nothing to apply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The old message was scary and included a 'fatal' error from rev-parse:
     fatal: Needed a single revision
     : no valid stashed state found

The new message is identical to the one given by 'git stash branch', and
given *before* the check for a dirty working tree.

Previously, the command prompted the user to clean a dirty working tree
when there is nothing to apply.

Signed-off-by: Ori Avtalion <ori@xxxxxxxxxxxxx>
---
 git-stash.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 03e589f..aa84144 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -162,6 +162,8 @@ show_stash () {
 }
 
 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'
-- 
1.6.4.73.gc144.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]