threads / discuss / 869

gitk (was Re: Linux v2.6.12-rc6)

Subject: gitk (was Re: Linux v2.6.12-rc6)

## tl;dr

2 messages between Jun 8, 2005 and Jun 10, 2005.

replies: 1people: 2as markdown or json

Linus Torvalds· Jun 8, 2005, 23:16 UTC · lore
Btw, Paul,
 one thing I end up missing in gitk is that looking at merges doesn't show 
any output, yet in many ways merges are actually the most interesting 
ones where you'd like to see where a file comes from..
Now, handling multi-way merges may be hard, but at least the normal 
two-way merges end up pretty straightforward, I think, and only have four 
cases for each file:
 - not touched by either side (ie it doesn't show up in either of 
   "git-diff-tree TREE PARENT1" or "git-diff-tree TREE PARENT2")
 - changed by PARENT1 only (ie it shows up in the git-diff-tree between 
   TREE and PARENT2)
 - changed by PARENT2 only
 - changed since both

and it would be cool if the "filename list" panel on the right side colorized the names by these things (only three cases - leave the "not touched" files off entirely, of course).

Also, it should actually possible to do a diff for these things with just doing a "diff3" on the two parents and on the merge result (diff3 normally expects the "original", but hey, the "original" might as well be the result), and thus color a merge file by whether the lines came from one side or the other or both (or neither, which would be a manual merge fixup).

Maybe I'm crazy. But it _seems_ like a good idea that shouldn't be fundamentally hard.

		Linus
Paul Mackerras· Jun 10, 2005, 10:57 UTC · re: Linus Torvalds · lore

Re: gitk (was Re: Linux v2.6.12-rc6)

Linus Torvalds writes:
> and it would be cool if the "filename list" panel on the right side 
> colorized the names by these things (only three cases - leave the "not 
> touched" files off entirely, of course).

Hmmm. How about this: each parent is given a color, and the file names are colored according to which parent they differ in. If a file differs in more than one parent it gets listed more than once in the colors for the parents in which it differs, with those entries being consecutive in the list.

If instead I list the file once in yet another color, I don't see how to make it intuitively obvious that that's what the color means, and I get a combinatorial explosion in the number of colors required as the number of parents grows (I would potentially need 2^n - 1 colors for n parents).

Show 6 quoted lines
> Also, it should actually possible to do a diff for these things with just
> doing a "diff3" on the two parents and on the merge result (diff3 normally
> expects the "original", but hey, the "original" might as well be the
> result), and thus color a merge file by whether the lines came from one
> side or the other or both (or neither, which would be a manual merge
> fixup).

I already have code in dirdiff to display n-way diffs in a single window, so it's certainly doable. I think I will do it a little differently in this case, though, because the final result has a special status. If I color lines according to which parent(s) they are present in and then have some other way to show which version was chosen (maybe a black box around those lines? or a little tick (check mark) or cross icon at the left hand edge of the line?) I think that should be pretty clear. (I'll need another color for the cases where the result is different to all of the parents, of course.)

Sounds interesting.  I'll have a look at it.
Paul.

← back to recent threads