Live data from Hacker News

Some of us like "interdiff" code review

gist.github.com

61–70 of 224 posts

Re: Some of us like "interdiff" code review

#61

When doing code reviews, I think it is annoying that every time I comment on a line, PR author gets a notification. This is not a simultaneous, real-time thing. I'm in the middle of doing my review, and my comments are not ready to be read. Maybe I'll change my mind on my comment on line 8 when I reach line 80.

GitLab lets you compose the entire review before submitting it so the author won't see anything until you're done.

Re: Some of us like "interdiff" code review

#62
> Interlude: Can you please just tell me if git rebase is evil or not so that we can derail the entire discussion over it?

Ha, that's funny. But yes, please we need interdiffs in GitHub and GitLab. I want to have my PRs/MRs always rebased and I don't want "fix code review comments" commits.

Re: Some of us like "interdiff" code review

#63

When doing code reviews, I think it is annoying that every time I comment on a line, PR author gets a notification. This is not a simultaneous, real-time thing. I'm in the middle of doing my review, and my comments are not ready to be read. Maybe I'll change my mind on my comment on line 8 when I reach line 80.

GitLab lets you compose the entire review before submitting it so the author won't see anything until you're done.

Github does, too. You just click "Start a review" when filling out your first comment.

Re: Some of us like "interdiff" code review

#64
post #4

Most of the complaints here could be solved by having smaller pull requests and then squashing commits when it’s time to merge.

That's like a caveman approach to the problem. Imagine the extra overhead required to submit the "refactor" commit. The result world be either nobody refactors or refactors are just bundled into the feature commit so it's never clear what you're actually reviewing.

Re: Some of us like "interdiff" code review

#65

When doing code reviews, I think it is annoying that every time I comment on a line, PR author gets a notification. This is not a simultaneous, real-time thing. I'm in the middle of doing my review, and my comments are not ready to be read. Maybe I'll change my mind on my comment on line 8 when I reach line 80.

GitLab lets you compose the entire review before submitting it so the author won't see anything until you're done.

GitHub as well.

Re: Some of us like "interdiff" code review

#66
I did code reviews on Azure devops and on Bitbucket. I noticed that Azure devops shows exactly this diff soup, and Bitbucket shows interdiffs, and comments do point to previous points in time etc. It is much better from both points of view.

Re: Some of us like "interdiff" code review

#67
I usually deal with “isolated patch series followed by a bunch of fixups” by letting them pile on top, then rebasing just before merging (the setting is usually feature branches all branched from main so that’s fine).

It is extra work and not everyone appreciates the benefits, so it’s hard to convince coworkers to do the same.

Re: Some of us like "interdiff" code review

#68
Nice article, it captures the issues I've had with code reviews very well. I'm just not sure the "pairwise diff" would work well in practice. Sometimes you do forget a change which should be separate commit (in between the existing commits), etc.

I recently got introduced to Sapling, specifically to the approach of never merging more than a single commit and also doing code reviews commit by commit. I like that idea even better!

Of course with existing tools like git & GitHub this seems rather difficult to implement, but Sapling automatically keeps track of how commits change across fixups & rebases, and it also handles entire "stacks" of merge requests / commits.

Re: Some of us like "interdiff" code review

#69

It's always exciting to see new approaches to code reviews - GitHub has its strengths, but it’s far from perfect. For the scenario you’ve outlined, have you thought about splitting the 3 patches into separate, dependent pull requests? While GitHub doesn’t natively support this, the right code review tool (shameless plug - I’m part of a team building one called GitContext) should allow you to keep pull requests small…

As mentioned elsewhere in this thread, this is also the approach that Sapling follows.

As for GitContext, how do you keep track of commits across fixups, rebases, reordering, etc.?

Re: Some of us like "interdiff" code review

#70

Earlier quoted context omitted.

We use stacked commits + rebase only in our company. The commit history is linear and it's very easy to revert changes. I don't see any advantage of using merging instead of rebase I am not sure why we need to squash commits. We encourage the opposite where you should commit small and often. So if we need to revert any commit, it's less painful to do so.

Without squashing it's hard for me to commit as small and often as I would like. Some things I want out of the final series of commits: 1) everything builds. If I need to revert something or roll back a commit, the resulting point of the codebase is valid and functional and has all passing tests. 2) features are logically grouped and consistent - kinda similar to the first, but it's not just that I want the build to…

I think there's an ambiguity here between squashing every commit in the PR into a single one, and squashing fixup commits made as responses to review into the commits that originated them.

For example, if the original commit series was

    Do a small refactor before I can start adding the test
    Add the test for the feature
    Do a small refactor before I can start adding the feature
    Work in progress
    Complete sub-feature 1
    Work in progress
    lint
    lint
    Complete sub-feature 2
    Respond to reviewer 1 comments
    Respond to reviewer 2 comments
Then you can either squash the entire PR down to

    Implement feature
or you can, using interactive rebase, squash (or more precisely fixup) individual WIP, lint, and response commits into where they belong to obtain

    Do a small refactor before I can start adding the test
    Do a small refactor before I can start adding the feature
    Complete sub-feature 1
    Complete sub-feature 2
where each commit individually builds and passes tests. I far prefecr the latter!
Post reply on HN