Reputation: 4925
Assume i have change #1 where i am adding two new functions A() and B() to MyFile.c . I fire change #1 to be reviewed on gerrit and i call this as review #1. Then, while review #1 is still going on, i introduce another change #2, where i add two new functions AA() and BB() to the same MyFile.c, where they make a call to A() and B() respectively. i call this review #2. My question is whether i can have change #2 reviewed by my peers while change #1 is still getting reviewed (not submitted yet). Obviously, i would like the addition of A() and B() on review #2 not to show as new functions, but only to have review #2 show incremental diff of change #2 with respect to change #1.
Is that possible? how can i do it?
Upvotes: 1
Views: 458
Reputation: 29821
Yes, that's possible.
Let's take a step back and not talk about Gerrit, but pure Git, and how the Git history looks on your local machine. In your local history you need to have commit #1 that introduces A() and B(), and on top of that commit #2 that introduces AA() and BB(). When you look at the diff of #2 it will only show the introduction of AA() and BB(), not the introduction of A() and B() of the previous commit.
Now when you push to Gerrit for review, a change is created for each commit that is not yet in the target branch. In other words, what Gerrit calls a change directly maps to a commit. As such, the diff in change #2 is exactly the diff of your second commit, and reviewers can comment on that no matter whether change #1 has already been reviewed or not.
Once both changes have passed reviewed you need to submit them for integration into the target branch. While you can hit the submit button of change #2 before the one for change #1, the integration of change #2 will be pending until change #1 has been integrated. So that's where order of commit dependencies is maintained: At integration time, not at review time.
Upvotes: 2