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

Re: "git-checkout-cache -f -a" failure

From
Junio C Hamano <junkio@cox.net>
Date
May 11, 2005, 05:16 UTC
Message-ID
<7vsm0us5p5.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050510230357.GF26384@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:

PB> What if you have some files not tracked by git in the subdirectory? PB> Either you need to check for this and deal with it (Cogito's approach PB> would be to remove the git-tracked files and rename the subdirectory), PB> or not do it at all.

Let me understand you correctly. You "rename the subdirectory" because the cache you want to check out records a non-directory there. Is this correct? When do you "remove the git-tracked files"? Do you mean "if a file that is not tracked (in the user's mind) is there in the filesystem, and the cache to be checked out has a file there, the file on the filesystem is removed"? What happens if an existing non-directory interferes with a directory to be checked out from the cache?

I think the right thing for the core GIT layer to do, when the end user is using the Plumbing tools directly and says "really please" by specifying an '-f', is to make the checkout succeed by removing conflicting stuff, as my fixed patch does.

If the Porcelain runs checkout-cache on the user's behalf, the story is a bit different. Porcelain would have some idea of what GIT tree the files in the working directory originated from ("the last commit", or "my head before the read-tree -m merge") before the user started working in it. When the user wants to update the work tree to match a cache (which may be quite different from "the last commit", if it is coming from cg-seek or result of a merge), the Porcelain knows:

 - the set of non git-tracked (from the point of view from "the
   last commit") files that are in the work tree;
 - among those, the set of files that would be overwritten by
   this checkout.  This includes, but not limited to, the files
   that would otherwise interfere because of file-directory
   conflicts.

And then you can set aside those "to-be-overwritten" files, remove them from the filesystem, and run your checkout.

The determination of which files to set aside should not be done based on whether they cause file-directory conflicts. If the user has a non-tracked file which happens to be registered as a tracked file in the cache to be checked out (e.g. after a three-way merge), that file is as valuable as a non-tracked file that is in a subdirectory that the new cache happens to have as a non-directory. Losing the former is as harmful as losing the latter. From what you say above, it sounds like you are saving the latter but not the former, but my readins of what you wrote above may be mistaken.

Previous: Petr BaudisNext: Morten Welinder
Message 6 of 19 in “"git-checkout-cache -f -a" failure”
  1. Morten WelinderMay 9, 2005
  2. Junio C HamanoMay 10, 2005
  3. Morten WelinderMay 10, 2005
  4. Junio C HamanoMay 10, 2005
  5. Petr BaudisMay 10, 2005
  6. Junio C HamanoMay 11, 2005
  7. Morten WelinderMay 11, 2005
  8. Junio C HamanoMay 11, 2005
  9. Junio C HamanoMay 11, 2005
  10. Test suitePetr Baudis, May 11, 2005
  11. Test suiteJunio C Hamano, May 12, 2005
  12. Petr BaudisMay 12, 2005
  13. Junio C HamanoMay 12, 2005
  14. Fix git-diff-files for symlinks.Junio C Hamano, May 12, 2005
  15. 0/3 Core GIT fixes and additions.Junio C Hamano, May 13, 2005
  16. checkout-cache fixJunio C Hamano, May 12, 2005
  17. Petr BaudisMay 12, 2005
  18. Junio C HamanoMay 12, 2005
  19. Junio C HamanoMay 11, 2005

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.