Repositories

Omar Jarjur <ojarjur@google.com>
83c4d7 Submitting review 8cb887077783
Omar Jarjur committed at 2015-12-18 17:46:10

Fix a bug where requesting a review would fail with an erroneous message.

We were figuring out the set of commits to include in a review by listing the commits between the head of the target ref and the head of the source ref. However, this only works if the source ref is a fast-forward of the target ref.

This commit changes it so that we use the merge-base of the target and source refs as the starting point instead of the target ref.

Modified commands/request.go

@@ -92,13 +92,13 @@ func requestReview(repo repository.Repo, args []string) error {
if err := repo.VerifyGitRef(r.ReviewRef); err != nil {
return err
}
base, err := repo.GetCommitHash(r.TargetRef)
base, err := repo.MergeBase(r.TargetRef, r.ReviewRef)
if err != nil {
return err
}
r.BaseCommit = base
reviewCommits, err := repo.ListCommitsBetween(r.TargetRef, r.ReviewRef)
reviewCommits, err := repo.ListCommitsBetween(base, r.ReviewRef)
if err != nil {
return err
}