microsoft / go

The Microsoft build of the Go toolset
BSD 3-Clause "New" or "Revised" License
250 stars 20 forks source link

`git go-patch extract` is sensitive to `am.threeWay` configuration, making patch resolution incompatible with CI in some cases #1233

Open dagood opened 1 month ago

dagood commented 1 month ago

To make it easier to work on patches, I tried setting git config --global am.threeWay true. This means when I run git go-patch apply, it will automatically do 3-way merges, rather than me needing to run git am -3 myself to see if that works.

The problem is that git go-patch extract uses am to detect whether a patch has changes and needs to be re-extracted. So, 3-way merge resolutions won't get checked into the dev's PR. CI doesn't use git am -3, so it fails to apply the patches. Noticed with https://github.com/microsoft/go/pull/1232.

Unsetting am.threeWay for the am used during git go-patch extract should be enough to fix this.

Workaround: git config --global am.threeWay false.


Intentionally setting am.threeWay=true during git go-patch apply might be nice, however this could be confusing, because it might not be obvious that some conflicts were resolved. I think this can wait for https://github.com/microsoft/go/issues/542.