google / git-appraise

Distributed code review system for Git repos
Apache License 2.0
5.13k stars 146 forks source link

Can't submit a code review #112

Open iveqy opened 2 years ago

iveqy commented 2 years ago

Hi, I'm having problem to submit a code review. I'm doing $ git appraise Loaded 2 open reviews: [pending] 8b692d60c974 Center checkbox, add padding

Solves: Odoo #869 [accepted] a2d5c3619740 Add missing dependency

The module won't installed without it since a view has dependencies on a view in base_geolocalize

$ git appraise submit a2d5 Refusing to submit a non-fast-forward review. First merge the target ref.

Adding some debug prints to git appraise it seems as git appraise tries to merge a2d5 to origin/master which is wrong since a2d5 is the review and not the actually branch commit that should be merged.

I'm a bit puzzled about this, because this not working should mean that git appraise doesn't work for anyone and that seems not to be the case, so it might be me doing something wrong, but what?

ojarjur commented 2 years ago

Hi @iveqy, thanks for reaching out, and sorry for the delay in responding; it seems that my GitHub notification settings are somehow messed up.

I'm assuming this is tied to your pull request https://github.com/google/git-appraise/pull/113, in which case that means you found that the issue was related to rebasing the commits in your review.

git-appraise does support the workflow of rebasing changes, but it has to be done within the bounds of the git-appraise tool.

For background, git-appraise tries to re-use the git history as much as possible; it aims to be the smallest possible additional layer on top of git in order to add support for reviews. That means tracking the changes between different commits in a review requires that there is some connection between those commits in git itself.

For fast-forward commits, this connection is already stored in the commit history. For rebase commits, however, there's no connection in the history, so we instead have to have some metadata about the connection that we store in git notes.

Accordingly, we provide a git appraise rebase command that will both perform the git rebase and write the necessary metadata linking the new commit with the original one.

However, if you don't go through git appraise rebase and instead rebase the commits using git directly, then we won't have that additional metadata and git-appraise will not have any way to know the two commits are in any way related.

Once you've gotten into that state, you won't be able to submit the change because the git-appraise tool doesn't know that your commits are related.

However, you can actually still fix this by just running the git appraise rebase command after the fact (prior to submitting). That will trigger an interactive rebase (which you can exit without changing anything), and afterwards will write out the missing metadata.