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

[PATCH 0/3] make sure stash refreshes the index properly

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Aug 27, 2019, 10:14 UTC
Message-ID
<20190827101408.76757-1-t.gummerer@gmail.com>
Thanks Peff for spotting the bug!  Here's a series that fixes it.
> And before the third one, introduction of a new entry point that
> makes merge-recursive machinery inherit the already populated
> in-core index, happens, I think the right solution is to write the
> in-core index out---the write is not pointless.

Yup, I agree with that. In fact there are some other places where we just call 'refresh_cache()' as a replacement for 'git update-index --refresh'. At least the other one in 'do_apply_stash()' also seems like a bug, as I assume the original intention (and behaviour) was that the index is refreshed after 'stash apply -q' finishes.

I think in do_push_stash and do_create_stash we might be able to get away without the write, but I wasn't 100% sure, so I made them write the index after refreshing it as well, which is what the shell script did.

The first patch is a small refactoring that makes the actual fix a bit easier, while the second patch is a cleanup that I found while there.

Thomas Gummerer (3):
  factor out refresh_and_write_cache function
  merge: use refresh_and_write_cache
  stash: make sure to write refreshed cache
 builtin/am.c     | 16 ++--------------
 builtin/merge.c  | 15 ++++-----------
 builtin/stash.c  | 11 +++++++----
 cache.h          |  9 +++++++++
 read-cache.c     | 17 +++++++++++++++++
 t/t3903-stash.sh | 16 ++++++++++++++++
 6 files changed, 55 insertions(+), 29 deletions(-)
-- 
2.23.0.rc2.194.ge5444969c9
Next: Thomas Gummerer
Message 1 of 29 in “make sure stash refreshes the index properly”
  1. 0/3 make sure stash refreshes the index properlyThomas Gummerer, Aug 27, 2019
  2. 2/3 merge: use refresh_and_write_cacheThomas Gummerer, Aug 27, 2019
  3. Martin ÅgrenAug 28, 2019
  4. Thomas GummererAug 29, 2019
  5. 3/3 stash: make sure to write refreshed cacheThomas Gummerer, Aug 27, 2019
  6. 1/3 factor out refresh_and_write_cache functionThomas Gummerer, Aug 27, 2019
  7. Martin ÅgrenAug 28, 2019
  8. Thomas GummererAug 29, 2019
  9. 0/3 make sure stash refreshes the index properlyThomas Gummerer, Aug 29, 2019
  10. 2/3 merge: use refresh_and_write_cacheThomas Gummerer, Aug 29, 2019
  11. 3/3 stash: make sure to write refreshed cacheThomas Gummerer, Aug 29, 2019
  12. 1/3 factor out refresh_and_write_cache functionThomas Gummerer, Aug 29, 2019
  13. Martin ÅgrenAug 30, 2019
  14. Junio C HamanoAug 30, 2019
  15. Thomas GummererSep 2, 2019
  16. Junio C HamanoSep 3, 2019
  17. 0/3 make sure stash refreshes the index properlyThomas Gummerer, Sep 3, 2019
  18. 1/3 factor out refresh_and_write_cache functionThomas Gummerer, Sep 3, 2019
  19. Junio C HamanoSep 5, 2019
  20. Thomas GummererSep 6, 2019
  21. Johannes SchindelinSep 11, 2019
  22. Thomas GummererSep 11, 2019
  23. Junio C HamanoSep 12, 2019
  24. 2/3 merge: use refresh_and_write_cacheThomas Gummerer, Sep 3, 2019
  25. 3/3 stash: make sure to write refreshed cacheThomas Gummerer, Sep 3, 2019
  26. 0/3 make sure stash refreshes the index properlyThomas Gummerer, Sep 11, 2019
  27. 1/3 factor out refresh_and_write_cache functionThomas Gummerer, Sep 11, 2019
  28. 2/3 merge: use refresh_and_write_cacheThomas Gummerer, Sep 11, 2019
  29. 3/3 stash: make sure to write refreshed cacheThomas Gummerer, Sep 11, 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.