mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
fix: missing push when files were changed (#193)
The whole check to avoid pushes when they were only rebases was broken and compared the wrong things. Unfortunately this worked for nearly all unit tests, except for one were I used the wrong assertion. This fixed the check by comparing the right things and inverting the assertion in the unit test to make sure things do not break again in the future. Bug was introduced in #114.
This commit is contained in:
parent
983162d26e
commit
50b2762dca
2 changed files with 7 additions and 5 deletions
|
|
@ -233,7 +233,7 @@ func (r *Repository) hasChangesWithRemote(ctx context.Context, mainBranchRef, lo
|
|||
return false, nil
|
||||
}
|
||||
|
||||
remoteDiff, err := commitOnRemotePRBranch.PatchContext(ctx, currentRemotePRMergeBase)
|
||||
remoteDiff, err := currentRemotePRMergeBase.PatchContext(ctx, commitOnRemotePRBranch)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@ func (r *Repository) hasChangesWithRemote(ctx context.Context, mainBranchRef, lo
|
|||
return false, err
|
||||
}
|
||||
|
||||
return remoteDiff.String() == localDiff.String(), nil
|
||||
return remoteDiff.String() != localDiff.String(), nil
|
||||
}
|
||||
|
||||
func (r *Repository) commitFromRef(refName plumbing.ReferenceName) (*object.Commit, error) {
|
||||
|
|
|
|||
|
|
@ -147,15 +147,17 @@ func TestRepository_HasChangesWithRemote(t *testing.T) {
|
|||
OnBranch(mainBranchRef),
|
||||
AsNewBranch(remotePRBranchRef),
|
||||
WithFile("VERSION", "v1.1.0"),
|
||||
WithFile("CHANGELOG.md", "Foo"),
|
||||
),
|
||||
WithCommit(
|
||||
"chore: release v1.2.0",
|
||||
"chore: release v1.1.0",
|
||||
OnBranch(mainBranchRef),
|
||||
AsNewBranch(localPRBranchRef),
|
||||
WithFile("VERSION", "v1.2.0"),
|
||||
WithFile("VERSION", "v1.1.0"),
|
||||
WithFile("CHANGELOG.md", "FooBar"),
|
||||
),
|
||||
),
|
||||
want: false,
|
||||
want: true,
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue