2

I am currently implementing Gerrit as central code review system. In the process of trying to understand the ins and outs of Gerrit, I got stuck at the sentence below. Taken from the Gerrit documentation:

As Gerrit implements the entire SSH and Git server stack within its own process space, Gerrit maintains complete control over how the repository is updated, and what responses are sent to the git push client invoked by the end-user, or by repo upload. This allows Gerrit to provide magical refs, such as refs/for/* for new change submission and refs/changes/* for change replacement.

What does the above statement mean, in particular this sentence: “As Gerrit implements the entire SSH and Git server stack within its own process space”? I tried searching for relevant questions, but the closest I have found is Why is git push gerrit HEAD:refs/for/master used instead of git push origin master, but it doesn’t provide an adequate explanation of how implementation of the server stack allows Gerrit to provide magical refs. Apologies if similar questions have indeed been asked before. Thank you!

Community
  • 1
  • 1
Tim
  • 23
  • 3

1 Answers1

0

It's not hard to implement a magical ref even in "normal git". You just have to implement pre-receive or update hook in your remote repository that recognizes the target branch of the push and do whatever it wants to with it (e.g. store the push in another branch).

Althought I do not have any implementation details (I suppose it's much more sophisticated), this is the same behavior as Gerrit's. You push to refs/for/master and it stores it in refs/changes/66/5066/2 branch (for example).

There are some examples.

Community
  • 1
  • 1
fracz
  • 18,175
  • 16
  • 93
  • 143
  • So you're saying that gerrit could be seen as a heavily customized central git repository? I think i'm beginning to understand. – Tim Apr 16 '16 at 09:15
  • And adds well defined workflow with code reviews, yes. – fracz Apr 16 '16 at 09:23