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

Re: [PATCH v1 1/1] git stash needing mkdir deletes untracked file

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2023, 20:57 UTC
Message-ID
<xmqqo7jgkk7s.fsf@gitster.g>
In-Reply-To
<6e40eb0b-2331-1e39-bee0-c9720c24d1c8@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 8 quoted lines
> Although this change is framed in terms of changes to "git stash push"
> I think the underlying issue and this patch actually affects all users
> of unpack_trees(). For example if "README" is untracked then
>
> 	git checkout <rev> README
>
> will currently fail if <rev>:README is a blob but will succeed and
> remove the untracked file if <rev>:README is a tree.

Very true, and with an .untracked file nobody asked Git to create, presumably? I am not sure if the updated behaviour is better than the current behaviour.

If "silent and unconditional removal" bothers us, I wonder if it is a lot better approach to error out and have the user sort out the mess, which is what we usually do when it gets tempting to "move it away with an arbitrary rename" like this patch tries to do. I dunno.

Thanks.
Previous: Junio C HamanoNext: Phillip Wood
Message 14 of 15 in “Lost files after git stash && git stash pop”
  1. Till FriebeJul 21, 2023
  2. Torsten BögershausenJul 22, 2023
  3. Phillip WoodJul 23, 2023
  4. Torsten BögershausenJul 23, 2023
  5. Phillip WoodJul 24, 2023
  6. 1/1 git stash needing mkdir deletes untracked filetboegi@web.de, Aug 8, 2023
  7. Torsten BögershausenAug 8, 2023
  8. Eric SunshineAug 8, 2023
  9. Phillip WoodAug 9, 2023
  10. Torsten BögershausenAug 9, 2023
  11. Phillip WoodAug 15, 2023
  12. Torsten BögershausenAug 15, 2023
  13. Junio C HamanoAug 15, 2023
  14. Junio C HamanoAug 9, 2023
  15. Phillip WoodAug 15, 2023

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.