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

Re: Am able to delete a file with no trace in the log

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 3, 2009, 01:20 UTC
Message-ID
<alpine.LFD.2.01.0906021811440.4880@localhost.localdomain>
In-Reply-To
<2e24e5b90906021747v327c9db1o16d03af5dcf50546@mail.gmail.com>
On Wed, 3 Jun 2009, Sitaram Chamarty wrote:
> 
> "git merge -s ours" would do precisely the same thing, wouldn't it?

Yes. It doesn't matter which way it goes - if a file is seen as being identical (and "none" very much counts) in one parent, it's not judged "interesting" from a merge patch standpoint, or even from a "git log" (aka "revision history") standpoint.

Show 6 quoted lines
> That has happened to me before, and I noticed that git log does not
> show the deletion, but rationalised it as being because I had
> explicitly done a "-s ours".
> 
> Fixing this would fix that (maybe more common) case too, and show that
> the merge commit removed the file.

The problem is that quite often, a merge that removes a file _is_ the correct thing when it was removed in one branch, and a merge that adds a file is even more common, and in no way special. We don't show the whole diff in a merge, because the whole diff is often nonsensical (ie so trivial that showing it all just hides the parts that are actually relevant).

So I'll have to think about it a bit more. We clearly don't generate good diffs for file deletion/creation in merges, and we should improve on it, but it's definitely not a trivial issue either.

		Linus
Previous: Sitaram ChamartyNext: Linus Torvalds
Message 6 of 26 in “Am able to delete a file with no trace in the log”
  1. Graham PerksJun 2, 2009
  2. Tony FinchJun 2, 2009
  3. Jeff KingJun 2, 2009
  4. Linus TorvaldsJun 2, 2009
  5. Sitaram ChamartyJun 3, 2009
  6. Linus TorvaldsJun 3, 2009
  7. Clean up and simplify rev_compare_tree()Linus Torvalds, Jun 3, 2009
  8. Junio C HamanoJun 3, 2009
  9. Linus TorvaldsJun 3, 2009
  10. Junio C HamanoJun 3, 2009
  11. Linus TorvaldsJun 3, 2009
  12. Linus TorvaldsJun 3, 2009
  13. Avery PennarunJun 3, 2009
  14. Junio C HamanoJun 3, 2009
  15. Linus TorvaldsJun 3, 2009
  16. Junio C HamanoJun 3, 2009
  17. Jeff KingJun 3, 2009
  18. Linus TorvaldsJun 3, 2009
  19. Jeff KingJun 3, 2009
  20. Linus TorvaldsJun 3, 2009
  21. Jeff KingJun 3, 2009
  22. Linus TorvaldsJun 4, 2009
  23. Junio C HamanoJun 4, 2009
  24. Linus TorvaldsJun 3, 2009
  25. Junio C HamanoJun 3, 2009
  26. Junio C HamanoJun 3, 2009

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.