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

Re: [PATCH] Make stashing nothing exit 1

From
MMMaxim Mazurok <maxim@mazurok.com>
Date
Apr 12, 2020, 13:08 UTC
Message-ID
<8F6FC77C-1784-4EF1-B005-2C01516A5BEB@mazurok.com>
In-Reply-To
<87d0mic9fm.fsf@evledraar.gmail.com>
Show 12 quoted lines
> * 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.
I was doing git automation where I’m doing this:
1. git stash push --keep-index --message all-changes
2. git stash push  --message staged-changed
3. git checkout -B my_branch master
4. git checkout stash -- .
6. git stash drop
7. git stash pop
The goal is to do this for every folder and put changes for this folder in it’s own branch. More info here: https://github.com/Maxim-Mazurok/google-api-typings-generator/blob/e4d277b67ee34999e2fea04cba7d06c97af9e6bb/bin/auto-update/index.ts#L57
So, I also found that "git stash push” doesn’t return 1 and I think it’s not in line with “git stash pop” behavior.
In my workflow it makes harder to find the problem.

Another problem is that sometimes “git stash” doesn’t seem to work. You can see by downloading full log from here: https://github.com/Maxim-Mazurok/google-api-typings-generator/runs/580274897 That at the bottom, when processing gapi.client.youtubereporting it says that both stashes (form step 1 and 2) were created, but then when running “git stash list” it shows only one stash. Because it only happens sometimes, I assume that it may be because filesystem not flushing all the changes immediately. Any help on this would be appreciated.

Regarding “git stash” return code, do you think it makes sense to add this to C implementation, create tests and find other potential inconsistencies? I would be happy to help. And it seems like other people also are facing this problem because “git stash” doesn’t fail: https://stackoverflow.com/questions/34114700/git-stash-pop-only-if-successfully-stashed-before

Regards, Maxim Mazurok

Previous: Johannes SchindelinNext: Junio C Hamano
Message 5 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.