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

Re: git stash deletes/drops changes of

From
John Keeping <john@keeping.me.uk>
Date
May 24, 2013, 16:01 UTC
Message-ID
<20130524160143.GF27005@serenity.lan>
In-Reply-To
<loom.20130524T174015-773@post.gmane.org>
On Fri, May 24, 2013 at 03:42:37PM +0000, Jim Greenleaf wrote:
Show 10 quoted lines
> John Keeping <john <at> keeping.me.uk> writes:
> 
> > I wonder if this would be better as a file rather than another option to
> > git-update-index.  We already have .git/info/exclude so we could add
> > .git/info/freeze or .git/info/local with the same syntax as the normal
> > .gitignore file.
> 
> .git/info/freeze would be a good solution.
> It would avoid the need to add a new class of files for git-status,
> while keeping a simple, familiar record of all frozen files in a single location.
Now I've thought about it a bit more, I'm not sure this does work.

If an entry in the freeze list means "ignore local changes in this file", we really want to be talking about local changes relative to some base. Otherwise, what happens if the upstream file is radically altered? A user probably doesn't want to keep their file unchanged when this happens.

So we don't just want to store the filename, we want to store the version of the file that the user chose to ignore. One way to do this might be to mark the file as a conflict whenever a change to it comes in and ignore the freeze file when there is a conflict in the index. But then we either need to introduce a new command to manage this state or some way for the user to perform Git operations ignoring the freeze file, otherwise how can the user pull down updates?

Perhaps a more user-friendly way to handle this would be to introduce auto-stash around any operation that will modify a frozen file. So we stash the user's (frozen) changes and then apply them after changing the file. If there are conflicts then these are marked in the index and must be resolved, then the unstaged changes in the file are ignored again.

Previous: Jim GreenleafNext: Petr Baudis
Message 11 of 20 in “git stash deletes/drops changes of "assume-unchanged" files”
  1. Adeodato SimóJun 4, 2010
  2. Jim GreenleafMay 23, 2013
  3. Thomas RastMay 23, 2013
  4. Junio C HamanoMay 23, 2013
  5. Thomas RastMay 23, 2013
  6. Junio C HamanoMay 23, 2013
  7. Phil HordMay 24, 2013
  8. Jim GreenleafMay 24, 2013
  9. John KeepingMay 24, 2013
  10. Jim GreenleafMay 24, 2013
  11. John KeepingMay 24, 2013
  12. Petr BaudisMay 23, 2013
  13. John KeepingMay 24, 2013
  14. Petr BaudisMay 24, 2013
  15. John KeepingMay 24, 2013
  16. Petr BaudisMay 24, 2013
  17. John KeepingMay 24, 2013
  18. Petr BaudisMay 24, 2013
  19. John KeepingMay 24, 2013
  20. Stephen BashMay 24, 2013

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.