Skip to content

Fix copying a patch crashing when a commit has none - #587

Merged
hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-copy-patch-crash
Aug 23, 2026
Merged

hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-copy-patch-crash

Conversation

@goneng

@goneng goneng commented Aug 23, 2026 •

Copy link
Copy Markdown
Collaborator

Leave out the commits that cannot produce a patch instead of inserting
their missing patch into the array being joined.

  • Declare the patch as absent, which is what it is once the
    format-patch task fails
  • Skip the commits the transformer has nothing to say about

Copy Patch asks each selected commit for its patch and collects the
results. The property was declared as always present, so the failure
the getter already handled and logged reached the array as nil and
raised, taking down the application rather than copying the commits
that did produce a patch.

Test plan:

  • GitXCommitCopierTests reproduces the crash with a commit whose
    patch is absent; it raises NSInvalidArgumentException before the
    fix and passes after
  • xcodebuild test -only-testing:GitXTests is green, 42/42
  • The build stays clean and drops one analyzer finding

Leave out the commits that cannot produce a patch instead of inserting
their missing patch into the array being joined.

- Declare the patch as absent, which is what it is once the
  format-patch task fails
- Skip the commits the transformer has nothing to say about

Copy Patch asks each selected commit for its patch and collects the
results. The property was declared as always present, so the failure
the getter already handled and logged reached the array as nil and
raised, taking down the application rather than copying the commits
that did produce a patch.
@goneng
goneng force-pushed the fix-copy-patch-crash branch from 167a08c to 25e5fc6 Compare August 23, 2026 13:53
@goneng
goneng marked this pull request as ready for review August 23, 2026 14:16
@goneng
goneng marked this pull request as draft August 23, 2026 14:16
@goneng
goneng marked this pull request as ready for review August 23, 2026 14:18
@hannesa2
hannesa2 merged commit c70d753 into gitx:master Aug 23, 2026
3 checks passed
@goneng
goneng deleted the fix-copy-patch-crash branch August 23, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet