Skip to content

Allow for merge conflicts in Merge-Branch.ps1#31726

Merged
hallipr merged 1 commit into
feature/spring-boot-3from
pahallis/merge-main
Oct 25, 2022
Merged

Allow for merge conflicts in Merge-Branch.ps1#31726
hallipr merged 1 commit into
feature/spring-boot-3from
pahallis/merge-main

Conversation

@hallipr

@hallipr hallipr commented Oct 25, 2022

Copy link
Copy Markdown
Member

Merge-Branch was exiting out if git merge returned a non-zero exit code. Because it returns exit code 1 when it detects merge-conflicts, I added a command output test looking for specific valid error output.

git merge $SourceBranch --no-ff --no-commit
if ($LASTEXITCODE) { ErrorExit $LASTEXITCODE }
git merge $SourceBranch --no-ff --no-commit | Tee-Object -Variable mergeOutput
if ($LASTEXITCODE -and -not $mergeOutput.EndsWith('Automatic merge failed; fix conflicts and then commit the result.')) { ErrorExit $LASTEXITCODE }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fail below if there is a merge failure still?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a failure other than the expected "fix conflicts" we should error exit with the "Unknown state, git reset --hard" message

If there's an exit code, but git's telling us to fix our conflicts and commit, then we're in an expected state and we should just continue as usual

@hallipr
hallipr merged commit fd520a2 into feature/spring-boot-3 Oct 25, 2022
@hallipr
hallipr deleted the pahallis/merge-main branch October 25, 2022 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants