News for hackers. Stuff that matters.
Re:Wikimedia is moving to Gitlab by js2 on Wednesday October 28, 2020 @11:25AM (#24919830)
I much prefer the model of force-pushing your development branch to create change sets. It lets you more easily see how development evolves in response to feedback. And the final state of the branch which gets merged leaves all the in-progress work that no one cares about behind only in Gerrit.

With Github/lab's model, if you force push your PR, you lose the ability to view its previous state and diff against that. Alternately, if you just keep adding commits, then the final branch that gets merged (unless you squash) has all the in-progress work which pollutes the repo's history.

Gerrit also has a finer grained permission model, but I don't care as much about that.

Gerrit definitely expects the user to understand how git works conceptually a bit more than Github/lab.

Re:Wikimedia is moving to Gitlab by nemetroid on Wednesday October 28, 2020 @12:12PM (#24920507)
> With Github/lab's model, if you force push your PR, you lose the ability to view its previous state and diff against that.

That's not quite true. Gitlab lets you compare any two "versions" of the force pushed branch.

Re:Wikimedia is moving to Gitlab by js2 on Wednesday October 28, 2020 @12:52PM (#24921057)
Thanks. I haven’t used gitlab. I assumed it worked the same as GitHub. That’s good to know.
Re:Wikimedia is moving to Gitlab by kevincox on Thursday October 29, 2020 @07:13AM (#24929245)
Yup, GitLab works as expected here. It's always surprised me how quickly the old commit is garbage-collrcted when you force-push a branch on GitHub. It causes weird errors in CI runs and breaks viewing the old commits.

Seriously I'll pay for those couple of KiB of space, just keep it around. (at least until the PR is closed)

Re:Wikimedia is moving to Gitlab by 0x0 on Wednesday October 28, 2020 @12:13PM (#24920528)
Gitlab DOES let you compare different versions of changesets in a merge request: https://docs.gitlab.com/ee/user/project/merge_requests/versi...
Re:Wikimedia is moving to Gitlab by u801e on Wednesday October 28, 2020 @06:31PM (#24924892)
> With Github/lab's model, if you force push your PR, you lose the ability to view its previous state and diff against that.

I'm not sure about Gitlab, but Github has recently added a feature where you can view the diff between the old branch head and new one. But, as far as I'm aware, there's no way to check out the previous branch head from the repo due to a lack of a remote branch pointing to it.

At least git itself provides a range-diff command that allows you do see a diff between the commits between two versions of a given branch.

Re:Wikimedia is moving to Gitlab by depressedpanda on Wednesday October 28, 2020 @01:03PM (#24921226)
But you don't force push with Gerrit?

Just update your change set, then push to refs/for/<branch_name> again.

Re:Wikimedia is moving to Gitlab by js2 on Wednesday October 28, 2020 @02:55PM (#24922696)
It's been a while since I used it, but I guess the more important point is that it's a rebase-based workflow.

My memory was you had to force push your working branch to refs/for. Thank you for the correction.

I've actually setup and run instances of it as two companies, but as I say, it's been a while.

Re:Wikimedia is moving to Gitlab by depressedpanda on Thursday October 29, 2020 @08:11AM (#24929631)
Yes, I very much agree: the rebase-based workflow is what makes Gerrit superior to all other systems I've tried (of which I find Github and Bitbucket particularly loathsome).

I felt I needed to correct you because with Gerrit you reserve the concept of force pushing for exceptional cases, which I think is the correct mental model. Force pushing should not be done frivolously.

Re:Wikimedia is moving to Gitlab by 20after4 on Wednesday October 28, 2020 @01:55PM (#24921938)
It's effectively similar to a force-push.
Re:Wikimedia is moving to Gitlab by depressedpanda on Thursday October 29, 2020 @08:02AM (#24929577)
I would say it's quite different, since you don't overwrite anything. Old patch sets are still available should you wish to roll back/reference either a particular commit, or a whole chain of commits.
Re:Wikimedia is moving to Gitlab by kortilla on Wednesday October 28, 2020 @03:57PM (#24923428)
It is a force push under the hood. You’re removing an old commit and creating a new one.
Re:Wikimedia is moving to Gitlab by lacksconfidence on Wednesday October 28, 2020 @06:30PM (#24924876)
It's not a force push under the hood. Under the hood a new branch is created (first patch set is /refs/changes/nnnn/0, second is /refs/changes/nnnn/1, etc.). From the end user perspective the result is quite plausibly similar to force push.
Re:Wikimedia is moving to Gitlab by kortilla on Wednesday October 28, 2020 @06:37PM (#24924958)
The branch model must have changed. I used to push directly to a branch that was the change number (not the revision number) and of course had to force because it was the same.

So what happens when you push to changes/nnnn/12 when revision 11 hasn’t been created?

Re:Wikimedia is moving to Gitlab by lacksconfidence on Wednesday October 28, 2020 @10:13PM (#24926352)
At least the way our installation works we don't push to changes/nnnn/12, rather changes are pushed to refs/for/{branch} (often refs/for/master). This endpoint isn't an actual branch. It triggers gerrit to look up the nnnn for the Change-Id in the commit message and create the appropriate branch for the next patch set.