Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some “Stage All” special cases #1037

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Cykelero
Copy link
Contributor

@Cykelero Cykelero commented Dec 3, 2024

This fixes two issues with the Stage All button.

Reproducing

Reproducing the conflict issue:

  • Cause a conflict from another app (e.g. by running a git pull)
  • Delete the file that's in conflict
  • In GitUp, try to Stage All: the operation aborts with a “No such file or directory” error

Reproducing the submodule issue:

  • In a repository, copy another repository (just copy a repo folder; don't use submodule features or anything)
  • In GitUp, try to Stage All in the outer repository: the operation aborts with a “submodule 'SUB_REPO_PATH' has not been added yet” error

Notes

The fixes look at the error messages to decide what to do—that might not be ideal, but:

  • The specific submodule error is emitted by libgit2, with no distinguishing metadata. To avoid reading the error message, we'd have to essentially reimplement that libgit2 behavior. The fix should hold over time, as libgit2 seems to change existing code fairly rarely, and is English-only. The fallout if the fix does break is minimal.
  • The “no such file” error also doesn't have distinguishing features that I could find (its code is a generic -1). That one feels flakier, as Apple could change the error message at any time, and the message could be localized if the app runs in a different language; but in practice, Apple is unlikely to change that message, and GitUp is in English only.

(Not always but) repository folders that weren't registered in .gitmodules would cause the method to fail: “libgit2 error (-4): submodule 'submodules/transfer-photo-albums/' has not been added yet”
When addFileInWorkingDirectory encountered an error, it would return YES regardless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant