Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:46:54


On Wed, 3 Jun 2009, Junio C Hamano wrote:
Linus Torvalds [off-list ref] writes:
quoted
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.
That is true.  The "crude attempt" patch I just sent actually catches
this, but it does not show the lossage of "new" in the "diff/diffstat"
part of the merge, when run with "git log --stat -- x".  Besides, it shows
too many other uninteresting "merged two branches, resolving to lossage of
the path the same way as all the previous merges" to be really useful.
Yes.

Thinking more about it, we always did have fairly good workarounds for the 
"we optimized away the history too aggressively" (ie the original 
--full-history, and then the newer and nicer --simplify-merges).

So I'm starting to suspect that I was just wrong in looking at the 
revision history simplification. Yes, that can cause simplification that 
we don't want, but on the other hand, it's reasonably easy to work around.

Maybe what we want is a better model for showing diffs from merges.

For example, right now there is _no_ way to get even a "show diff relative 
to first parent". You can do "-m", which will show it relative to _both_ 
parents, but nobody ever wants that. And you can do "-c" or "--cc", but 
that simplifies away all the paths that match in one. 

So here's a challenge: in the git repository, get a nice view of what your 
merges looked like. The closest I can get is

	git log -c --stat --grep="Merge branch '"

which is actually very non-intuitive ("-c" on its own gives no useful 
output, but "-c --stat" gives nice diffstat against the first parent, 
which in this case is what we want).

But I can't actually get git to generate the _patch_ that the --stat 
describes. You'd have to do something like

	git rev-list --parents --grep="Merge branch '" HEAD |
		while read a b c; do git show -s $a ; git diff $b..$a; done | less -S

which is pretty ugly.

			Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help