git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make stashing nothing exit 1

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 23, 2019, 07:54 UTC
Message-ID
<87d0mic9fm.fsf@evledraar.gmail.com>
In-Reply-To
<01020169a7ad6af3-ad50e2d1-19fb-46eb-b397-759f8d579e8b-000000@eu-west-1.amazonses.com>
On Sat, Mar 23 2019, Keith Smiley wrote:
Show 19 quoted lines
> In the case there are no files to stash, but the user asked to stash, we
> should exit 1 since the stashing failed.
> ---
>  git-stash.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-stash.sh b/git-stash.sh
> index 789ce2f41d4a3..ca362b1a31277 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -318,7 +318,7 @@ push_stash () {
>  	if no_changes "$@"
>  	then
>  		say "$(gettext "No local changes to save")"
> -		exit 0
> +		exit 1
>  	fi
>
>  	git reflog exists $ref_stash ||
Thanks for contributing, some points:
 * stash is currently (in the 'next' branch) being rewritten in C. It's
   a better move at this point to patch that version, this code is about
   to be deleted.
 * This is missing a corresponding test, and skimming the stash manpage
   we should document how these exit codes are supposed to act.
 * Shouldn't we do this consistently across all the other sub-commands?
   Trying some of them seems 'push' may be the odd one out, but maybe
   I've missed some (and this would/should be covered by
   tests). I.e. some single test that does a bunch of ops with no
   entries / nothing to stash and asserts exit codes.
Previous: Keith SmileyNext: Eric Sunshine
Message 2 of 10 in “Make stashing nothing exit 1”
  1. Make stashing nothing exit 1Keith Smiley, Mar 22, 2019
  2. Ævar Arnfjörð BjarmasonMar 23, 2019
  3. Eric SunshineMar 24, 2019
  4. Johannes SchindelinMar 25, 2019
  5. Maxim MazurokApr 12, 2020
  6. Junio C HamanoMar 24, 2019
  7. Maksim OdnoletkovMay 22, 2019
  8. Ævar Arnfjörð BjarmasonMay 23, 2019
  9. Johannes SixtMay 23, 2019
  10. Maksim OdnoletkovMay 23, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.