From 047bb242285e7eeefdecc5fa64a28b5433c0f48a Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Wed, 20 Jul 2022 18:46:58 +0200 Subject: [PATCH] Look at the current reviewRef when submitting When a review has been rebased and then force pushed to update a review, for example to fix review comments. It can become impossible to submit with the error message: Refusing to submit a non-fast-forward review. First merge the target ref. this even if the review ref is a ancestor of the target ref and the merge should been a fast forward merge. This is because the check for appraise submit is done against the first commit sha1 that was used and not for the actually reviewRef that will be merged. This fixes that. --- commands/submit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/submit.go b/commands/submit.go index 58fa0023..b1dcc13d 100644 --- a/commands/submit.go +++ b/commands/submit.go @@ -78,8 +78,8 @@ func submitReview(repo repository.Repo, args []string) error { if err := repo.VerifyGitRef(target); err != nil { return err } - source, err := r.GetHeadCommit() - if err != nil { + source := r.Request.ReviewRef + if err := repo.VerifyGitRef(source); err != nil { return err }