Message ID | pull.383.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Improve the readability of log --graph output | expand |
On 10/10/2019 12:13 PM, James Coglan via GitGitGadget wrote: > This series of patches are designed to improve the output of the log --graph > command; their effect can be summed up in the following diagram: > > Before After > ------ ----- > > * > |\ > | * * > | |\ |\ > | | * | * > | | | | |\ > | | \ | | * > | *-. \ | * | > | |\ \ \ |/|\| > |/ / / / | | * > | | | / | * | > | | |/ | |/ > | | * * / > | * | |/ > | |/ * > * | > |/ > * I took a brief look through your series, and I think this is a really cool improvement. I use "git log --graph" all the time and those kinks have bothered me, too. I'd give you extra bonus points if your first patch added the case on the left as an expected output and we watch it get simpler as you modify the behavior in pieces. I do really like how you isolated different transformations into different commits. I would have given more specific feedback if I was more familiar with graph.c. I'll need to play with it more to give more substantive feedback. The only thing I could complain about in the first glance is some test file formatting stuff, like how you split a test case into "setup" "create expected output" and "test the output". That would be better as one test. Also you add a space between your redirect character and your file ("> expect" instead of ">expect"). Those nits aside, I look forward to digging into the code more soon. Thanks, -Stolee
On Thu, Oct 10, 2019 at 09:13:42AM -0700, James Coglan via GitGitGadget wrote: > A final addition to that set of changes fixes the coloring of dashes that > are drawn next to octopus merges, in a manner compatible with all these > changes. The early commits in this set are refactorings that make the > functional changes easier to introduce. As somebody who has pondered the octopus coloring code (for an embarrassingly long time considering that it still has some bugs!), let me just say thank you for taking this on. :) Moreover, I'll echo Dscho's comments elsewhere on the quality of this series. It's a tricky topic to explain, and the way you've broken it up, along with the commit messages, comments, and diagrams made it much easier to follow. Others have already commented on things I saw while reading it, so I'll just add a few more thoughts. > This series of patches are designed to improve the output of the log --graph > command; their effect can be summed up in the following diagram: > > Before After > ------ ----- > > * > |\ > | * * > | |\ |\ > | | * | * > | | | | |\ > | | \ | | * > | *-. \ | * | > | |\ \ \ |/|\| > |/ / / / | | * > | | | / | * | > | | |/ | |/ > | | * * / > | * | |/ > | |/ * > * | > |/ > * I wondered if anybody would prefer the sparseness of the "before" diagram, and if that would merit having two modes that could selected at runtime. I'm not sure I'd want to carry the code for both types, though; it seems like a recipe for the non-default output format to accrue a bunch of bugs (since the graph code has proven itself to be a magnet for off-by-ones and other weirdness). Diffing the output of "git diff --color --graph --oneline" on git.git both before and after your patch, the changes all look generally positive to me. The graph above is pretty dense, but that's not really what real-world graphs look like; it was designed to show off the changes. That plus the fact that you're fixing real bugs (like the octopus coloring) makes me inclined to just move to your suggested output. -Peff
On 13/10/2019 08:15, Jeff King wrote: > On Thu, Oct 10, 2019 at 09:13:42AM -0700, James Coglan via GitGitGadget wrote: > >> A final addition to that set of changes fixes the coloring of dashes that >> are drawn next to octopus merges, in a manner compatible with all these >> changes. The early commits in this set are refactorings that make the >> functional changes easier to introduce. > > As somebody who has pondered the octopus coloring code (for an > embarrassingly long time considering that it still has some bugs!), let > me just say thank you for taking this on. :) > > Moreover, I'll echo Dscho's comments elsewhere on the quality of this > series. It's a tricky topic to explain, and the way you've broken it up, > along with the commit messages, comments, and diagrams made it much > easier to follow. > > Others have already commented on things I saw while reading it, so I'll > just add a few more thoughts. > >> This series of patches are designed to improve the output of the log --graph >> command; their effect can be summed up in the following diagram: >> >> Before After >> ------ ----- >> >> * >> |\ >> | * * >> | |\ |\ >> | | * | * >> | | | | |\ >> | | \ | | * >> | *-. \ | * | >> | |\ \ \ |/|\| >> |/ / / / | | * >> | | | / | * | >> | | |/ | |/ >> | | * * / >> | * | |/ >> | |/ * >> * | >> |/ >> * > > I wondered if anybody would prefer the sparseness of the "before" > diagram, and if that would merit having two modes that could selected at > runtime. I'm not sure I'd want to carry the code for both types, though; > it seems like a recipe for the non-default output format to accrue a > bunch of bugs (since the graph code has proven itself to be a magnet for > off-by-ones and other weirdness). You're probably right about the non-default mode hiding bugs, but if you did want to do this, I believe the original rendering can be preserved by the following small switches: - always set `merge_layout = 1`; this will prevent skewing to the left - do not modify `edges_added` if the last parent fuses with its neighbor I believe all the layout changes are driven by these values, so you should be able to set in such a way as to preserve the original rendering by ignoring the special cases that lead to them having different values.