Repositories

This is important, because for a pending review, what the user really cares about is the current diff between their review branch and their target branch, not the historical diff between what their target branch was and what their review branch currently is.

To provide a more concrete example; let's say you start a review, see that there are new changes in your target branch, merge in those changes, and then run "git appraise show --diff".

In that scenario, you do not want your diff to include the latest changes to the target branch that you have merged in. This change makes it so that such changes will not be displayed as part of the diff.

Modified review/review.go

@@ -366,10 +366,6 @@ func (r *Review) GetHeadCommit() (string, error) {
// GetBaseCommit returns the commit against which a review should be compared.
func (r *Review) GetBaseCommit() (string, error) {
if r.Request.BaseCommit != "" {
return r.Request.BaseCommit, nil
}
if err := repository.VerifyGitRef(r.Request.TargetRef); err != nil {
return "", err
}
@@ -383,6 +379,10 @@ func (r *Review) GetBaseCommit() (string, error) {
}
if repository.IsAncestor(rightHandSide, leftHandSide) {
if r.Request.BaseCommit != "" {
return r.Request.BaseCommit, nil
}
// This means the review has been submitted, but did not specify a base commit.
// In this case, we have to treat the last parent commit as the base. This is
// usually what we want, since merging a target branch into a feature branch