Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #282
I use submodules every day at work and I think GitUp is the best Git interface so this has been a regular issue for me for way too long 🤪
The basic UI I came up with looks like this:
It closely matches the current submodule diff UI, but with buttons to choose which commit should be chosen (as a side note, in a future update it would be interesting to also pull the title of each commits and display it in the diff/conflicts views as I don't know my commit SHA1s by heart).
The "sketchiest" part of this PR is probably in GCDiff.m lines 358-377. I've written an explanation in a comment right above the code to justify it, but it would be nice if the superfluous untracked diff entry was not returned by libgit2 at all, but I couldn't find any combination of diff options that could do that.
Before
Submodule conflicts weren't handled at all and any rebase that involves a submodule conflict errors out in GitUp (and the repository needs to be "Reset to Checkout..." to get a clean working directory again | Submodule conflicts can be handled with a "Choose ours" or "Choose theirs" button
Screen.Recording.2024-04-26.at.6.20.58.PM.mp4
After
Submodule conflicts can be handled with a "Choose ours" or "Choose theirs" button
Screen.Recording.2024-04-26.at.6.23.39.PM.mp4
Here's the repository I used for my tests:
test-repo-submodules.zip
Once #989 is merged, I could use it as a base to write a unit test that checks that submodule conflicts are well handled.
I AGREE TO THE GITUP CONTRIBUTOR LICENSE AGREEMENT