git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pascal Malaise" <malaise@magic.fr>
To: git@vger.kernel.org
Subject: "Stash save" exits with 0 when nothing to stash
Date: Wed, 24 Dec 2014 10:20:30 +0100	[thread overview]
Message-ID: <20141224090636.M86902@magic.fr> (raw)

Hi,

When calling "git stash save" in a clean situation (no change since last
commit), git-stash reports "No local changes to save", which is OK.
But it exits with code 0, despite no stash has been saved.
It would be better to exit with code 1 in this case.

N.B. In a similar situation  "git commit -a -m 'Test'" reports
> On branch master
> nothing to commit, working directory clean
and exits with code 1.

Thanks

diff -u  git-master/git-stash.sh exit1/git-stash.sh 
--- git-master/git-stash.sh	2014-12-22 20:43:48.000000000 +0000
+++ exit1/git-stash.sh	2014-12-24 08:59:00.804150443 +0000
@@ -257,7 +257,7 @@
 	if no_changes
 	then
 		say "$(gettext "No local changes to save")"
-		exit 0
+		exit 1
 	fi
 	test -f "$GIT_DIR/logs/$ref_stash" ||
 		clear_stash || die "$(gettext "Cannot initialize stash")"

                 reply	other threads:[~2014-12-24 10:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141224090636.M86902@magic.fr \
    --to=malaise@magic.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).