Write merge conflicted files when pulling#559
Conversation
|
This has tests now ✅ |
|
I revised this PR and move the merge algorithm to it's own function so it can be used independently when merging branches. The reason I did this was because I was beginning to implement merging branches in Git2Go and saw that is was exactly the same procedure as pulling and we should probably factor it out. This also made pulling way easier to grasp. I am open to suggestions regarding the naming of the merge function. |
ObjectiveGit/GTRepository+Merging.h
Outdated
|
|
||
| /// Merge Branch into current branch | ||
| /// | ||
| /// analysis - The resulting analysis. |
There was a problem hiding this comment.
Looks like this isn't an argument anymore.
ObjectiveGit/GTRepository+Merging.h
Outdated
| /// fromBranch - The branch to merge from. | ||
| /// error - The error if one occurred. Can be NULL. | ||
| /// | ||
| /// Returns YES if the nerge was successful, NO otherwise (and `error`, if provided, |
ObjectiveGit/GTRepository+Merging.m
Outdated
| GTRepository *repository = entriesPayload->repository; | ||
| GTRepositoryEnumerateMergeHeadEntryBlock enumerationBlock = entriesPayload->enumerationBlock; | ||
|
|
||
| GTCommit *commit = [repository lookUpObjectByOID:[GTOID oidWithGitOid:oid] objectType:GTObjectTypeCommit error:NULL]; |
There was a problem hiding this comment.
I wonder if the merge head methods should yield OIDs instead of commits, so users don't incur the lookup overhead unless they actually need the commits. Thoughts?
There was a problem hiding this comment.
Hm, you basically take the results of this method and put it into the parents of the merge commit. I mean it's only a matter of another map so I omitted that. But we totally could switch to GTOIDs as this would map 1:1 to the libgit2 functionality.
|
💃 Just the one question left. |
|
@joshaber Changed the implementation to return GTOID objects 🚀 |
|
Would be nice to have a new version including this and Bitcode ✌️ |
|
🤘 |
Write merge conflicted files when pulling
This mimics the default
gitbehaviour and writes the conflicted files down like this:It also writes into
.git/MERGE_HEADthe remote commit SHA, into.git/MERGE_MSGthe correct merge message. It can then be pulled in the merge commit viatry repository.preparedMessage().The merge head enumeration was added so the merge commit can pull all merge heads and use them as parent commits.