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
Avery Pennarun <apenwarr@gmail.com>
Date
Jun 3, 2009, 21:59 UTC
Message-ID
<32541b130906031459p32640f4dte5e2e079cf4093d7@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.01.0906031431100.4880@localhost.localdomain>

On Wed, Jun 3, 2009 at 5:33 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:

Show 18 quoted lines
> On Wed, 3 Jun 2009, Junio C Hamano wrote:
>> E.g. "git log --graph --oneline -- git-clone.sh" shows that the scripted
>> version ceased to exist at 8434c2f
>
> Btw, this example misses the whole point of the original problem.
>
> The original problem was:
>
>  - create new file 'x' in branch 'a'
>
>  - merge branch 'a' into branch 'b', but because of a merge conflict and
>   confurion in the merge, the merge result doesn't contain 'x' any more.
>
>  - try to find out what happened to 'x' after-the-fact.
>
> Try it. Git really doesn't make it very easy, because git will notice that
> 'x' didn't exist before the branch either (in branch 'b'), so there will
> be _no_ sign of 'x' actually going away.

Note that full-file deletion is only one particular case of a general problem. Consider this script:

===

#!/bin/bash rm -rf testb mkdir testb cd testb git init echo 'initial a' >a echo 'initial b' >b git add a b git commit -m 'initial commit'

git branch sub

echo 'first a change' >>a git add a git commit -m 'modify a'

git checkout sub echo 'second a change' >>a git add a git commit -m 'modify a differently'

git checkout master git merge -s ours sub

===

"git log -p" will show the addition of the line "second a change" to a, but it doesn't show that, in fact, this line was later deleted because of a botched merge. There is no obvious way to find out in which commit the line was lost. If someone doing a code review is reviewing all the patches from "git log -p", then they'll miss the fact that this patch was lost.

('git log -p -- a" doesn't show that the line was added at all - which is true, in some sense, but it's equally true that, in the example you gave, 'x' was never added.)

Have fun,
Avery
Previous: Linus TorvaldsNext: Junio C Hamano
Message 13 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.