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

Re: possible bug in git apply?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 5, 2007, 04:53 UTC
Message-ID
<alpine.LFD.0.999.0708042148440.5037@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.999.0708042141510.5037@woody.linux-foundation.org>
On Sat, 4 Aug 2007, Linus Torvalds wrote:
Show 5 quoted lines
>
> But yeah, it seems that the file *rename* ends up not triggering that 
> logic! Very annoying.
> 
> Does this fix it? Totally untested, but it _looks_ obvious enough..

Side note: git will never remove a directory even if it becomes empty as far as *git* is concerned, if there are other files that git doesn't know about in there. So if you really really want to remove that directory, you do end up having to often just doing

	rm -rf some/dir/

and the fact that you don't find a "git rmdir" is that with git, you really should not even need it.

We do "git mv" and friends, but the fact is, that may have confused people into thinking that git cares.

The "default mindset" should be to just do everything directly in the filesystem, and git will just figure things out on its own. The "git mv" and "git rm" stuff is purely *convenience* features, nothing more.

Other SCM's really want you to do "scm rm" or "scm cp" or whatever. Git really really really doesn't care, and I think people are a bit too afraid of just doing the operation the normal UNIX way.

So next time you want to remove a directory, just remove it. With bog-standard unix tools. Use "rm". Or a graphical file manager. Or muck with the disk directly using a binary editor. Git won't care. It will notice that the file is gone, and do the right thing.

		Linus
Previous: Linus TorvaldsNext: Junio C Hamano
Message 5 of 15 in “possible bug in git apply?”
  1. david@lang.hmAug 4, 2007
  2. Junio C HamanoAug 4, 2007
  3. David KastrupAug 4, 2007
  4. Linus TorvaldsAug 5, 2007
  5. Linus TorvaldsAug 5, 2007
  6. Junio C HamanoAug 5, 2007
  7. David KastrupAug 5, 2007
  8. Linus TorvaldsAug 5, 2007
  9. David KastrupAug 5, 2007
  10. Linus TorvaldsAug 5, 2007
  11. David KastrupAug 5, 2007
  12. Linus TorvaldsAug 5, 2007
  13. David KastrupAug 5, 2007
  14. Junio C HamanoAug 6, 2007
  15. Junio C HamanoAug 6, 2007

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.