libgit2 / objective-git

Objective-C bindings to libgit2
MIT License
1.16k stars 280 forks source link

Fix mergeBranchIntoCurrentBranch: for conflicted state conditions #604

Closed slavikus closed 7 years ago

slavikus commented 7 years ago

checkout_opts passed to libgit2 missed a GIT_CHECKOUT_SAFE strategy, causing a dry run and only conflicted files being written out to the tree (losing all other non-conflicted ones).

This is because libgit2 has a safeguard check in git_merge call, auto-adding GIT_CHECKOUT_SAFE when no checkout_opts where specified, but since the Objective-Git code specified GIT_CHECKOUT_ALLOW_CONFLICTS flag, it wasn't applied, causing the behaviour outlined above:

checkout_strategy = given_checkout_opts ? given_checkout_opts->checkout_strategy : GIT_CHECKOUT_SAFE;

slavikus commented 7 years ago

Also added contents of PR #602 as it wasn't accepted earlier, sorry.

slavikus commented 7 years ago

Looks like travis has a wrong version of libssh installed, so it fails for macOS builds :(

slavikus commented 7 years ago

@tiennou you're best with these, would you please spend a few moments of your precious time on this one? :)

tiennou commented 7 years ago

Would you be so kind to rebase that branch onto master ? I'm not fond of twisty histories 😉.

Apart from that, LGTM. I have a few concerns on that merge code though, but that's not on you.

slavikus commented 7 years ago

@tiennou, will do today. Should I close this pull request and make a new one instead?

As for the merge code itself, yep, it could use some improvement (like finding the ancestor at the very least), but I decided to go baby steps.

tiennou commented 7 years ago

If that's easier for you, create a new one. Personally, I would just force-push the rebased branch to fix-merge-branch, but that might not work for you.

slavikus commented 7 years ago

Created PR #605 , closing this one.