Conversation
The vendored xcconfig caps Mac targets at x86_64, which leaves the test target with nothing valid to build on Apple Silicon. - Override VALID_ARCHS with "x86_64 arm64" on all four test configurations, matching what the framework target already does. - Without it the target produces no binary and the build stops at "Build input file cannot be found" before compiling a single source file, so none of the errors behind it were ever visible.
git_buf dropped its asize member when libgit2 1.x moved the allocated size into reserved, so the NSData specs stopped compiling. - Read buffer.reserved instead. git_buf_grow still writes the allocation size there, so all three assertions keep the meaning they had against 0.28. - Leave the deprecated git_buf and git_strarray calls around them alone; they still resolve through deprecated.h, which carries no deprecation attribute, and removing them belongs with the rest of the shim cleanup.
Quick 7 turned the spec entry point into a class method, so self in a spec body is now the spec class rather than the example being run, and the fixture helpers are instance methods on QuickSpec. - Send the fixture helpers to QuickSpec.current, the instance XCTest is running, so each example still gets its own temp directory. - Give SwiftSpec the class-method signature so it overrides Quick's spec() again. Swift compiles first in a mixed target, so this one error hid every Objective-C error behind it. - Fourteen of these were hard errors. The rest compiled only because clang allows any known selector on a bare Class, and would have raised unrecognized selector at run time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why this is needed
objective-git ships 207 unit tests. None of them have run in years,
because the target they live in does not compile. CI never says so: the
Test projectstep has been commented out inBuildPR.yml:50since"Split test and archive in CI" (Feb 2025), so only
Archive projectruns and a dead test target looks exactly like a healthy one.
That is not a theoretical gap. #107 fixed a stack overrun in
GTRepository+Merging.m, where agit_merge_file_inputwas initializedwith
git_merge_file_options_init, memcpy'ing a 48-byte template over a40-byte struct.
GTRepositorySpec.m:264calls the very method thatcontained it. A test target that built would have had a real chance of
catching it, and the same class of bug can walk in again tomorrow.
This PR does not enable tests in CI and does not make the suite pass. It
makes the target build and the suite run, which is the prerequisite for
both, and it is a prerequisite for #80 as well.
What was broken
Three independent things, each hiding the next:
No valid architecture. The vendored xcconfig sets
VALID_ARCHS = x86_64for Mac targets. The framework targetoverrides it with
"x86_64 arm64"; the test target never did. OnApple Silicon the target produced no binary at all and the build
died at
Build input file cannot be found, before compiling asingle source file.
git_buf.asizeis gone. libgit2 1.x moved the allocated sizeinto
reserved. The threeNSDataGitSpecassertions keep theiroriginal meaning, because
git_buf_growstill writes the allocationsize into that field.
The specs were never migrated to Quick 7.
QuickSpecBeginnowexpands to
+ (void)spec, soselfin a spec body is the specclass, not the running example, while the fixture helpers are
instance methods on
QuickSpec. Fourteen of these were hard errors.The other 79 compiled only because clang permits any known selector
on a bare
Class, and would have raisedunrecognized selector sent to classat run time, so fixing only the 14 would have produced atarget that builds and then dies on the first example.
What still blocks a green run
Worth knowing before anyone turns the CI step back on. Neither is caused
by this PR, and both are better handled separately:
fixtures.zipcannot be extracted by a modern ZipArchive. It holds 66absolute symlinks under
repo-with-submodule/.git/modules/**thatpoint into
/Applications/GitHub.app/..., left by the GitHub for Macclient that produced the fixture in 2013. ZipArchive 2.6.0 rejects any
symlink escaping the destination and aborts the whole extraction, so
no fixture repository is ever created. Worse, the half-extracted
directory is then treated as a valid cache by
setUpRepositoryFixtureIfNeeded:, so the unzip is never retried.beginWithforce-casts the actual value toString(
BeginWith.swift:49), soexpect(nil).to(beginWith(...))aborts thewhole xctest process instead of failing one example.
Test plan
xcodebuild -workspace ObjectiveGitFramework.xcworkspace -scheme "ObjectiveGit Mac" build-for-testing ARCHS=arm64gives** TEST BUILD SUCCEEDED **, exit 0, zero errors. On master the samecommand fails with
Build input file cannot be found.test-without-buildingthen runs the suite for the first time: 207tests executed, where master executes none. They fail, every one of
them traceable to the fixture extraction described above, which is
the next thing to fix.
the 14
incomplete definition of type 'struct objc_class'errors, soeach commit is doing work that is actually needed.