Skip to content

[Test only] fix discovered git dir length - #608

Closed
hannesa2 wants to merge 16 commits into
v1.5.5from
test/fix-discovered-git-dir-length
Closed

hannesa2 wants to merge 16 commits into
v1.5.5from
test/fix-discovered-git-dir-length

Conversation

@hannesa2

Copy link
Copy Markdown
Contributor

No description provided.

goneng and others added 15 commits August 20, 2026 00:44
Add tests for the two commits of #571 that landed without any, and for
the notification ordering that the third one changed.

PBGitIndexReconcileTests covers how the file list is derived, but
nothing exercised what surrounds it: that staging re-reads the index
rather than trusting the flags it has just set, that a refresh announces
the file list only once it has been rebuilt from all three commands, and
that a request arriving during a refresh is deferred rather than
discarded.

None of that needs a repository on disk. -[PBGitRepository init] touches
nothing outside itself, and the two collaborators that would otherwise
reach the filesystem are ordinary overridable methods, so test-local
subclasses record the calls instead of making them.

- Extract the refresh guard into -beginRefreshOrDeferIt and
  -endRefreshTakingDeferred so the coalescing contract can be asserted
  directly, leaving what they do unchanged
- Add PBGitIndexRefreshTests: staging and unstaging ask git and then
  read the index back, a rejected update-index reads nothing back,
  neither arm of a per-command result announces an index update, and a
  burst of requests collapses into exactly one re-run
- Give the GitXTests target a header search path for Classes/Util, which
  PBGitRepository_PBGitBinarySupport.h needs
Add tests for the index refresh and staging wiring
Move the unit test target out from behind the secret-gated screenshot
block, so that it also covers fork pull requests and pushes to master.

The screenshot pipeline needs the signing certificate, the pinned repo
snapshot and the comparison credentials, so gating it on the presence
of a secret is right. The unit tests were swept into that gate by
sitting inside the same block, and they need none of it: no signing,
no screenshot repo, no network, no repository on disk.

- Add a "Run unit tests" step limited to GitXTests, ad-hoc signed and
  gated on nothing but the arm64 runner
- Place it ahead of the screenshot pipeline so that a unit failure
  stops the job before the expensive steps run
- Leave the existing screenshot block untouched
The window controller creates its sidebar into `_sidebarController`, but
the `sidebarViewController` property is backed by `_sidebarViewController`,
which nothing ever assigns, so the property always returned `nil`.

- Rename the ivar to the name the property synthesizes
- This revives `-selectedRef`, whose sidebar branch could never be taken
Assert that the window hands out the three view controllers it builds,
which is the seam the sidebar property was silently failing at, and
that the ref a ref action acts on follows whichever list has focus.

- Load the real window nib and let `-windowDidLoad` build the controllers,
  rather than assembling them the way the other suites do
- Check the sidebar handed out is the installed one, not a second
  instance
- Assert a focused sidebar names its branch, and a REMOTES row the whole
  remote, which is what fetch and pull are offered on
- Assert the history list still names the single branch on the selected
  commit, and nothing when two branches share it
- Back it with a repository created under `NSTemporaryDirectory`, since
  the nib does not survive a repository with nothing in it
Move the history-list to a branch tip only while a sidebar branch change
is outstanding, instead of on every update the list happens to get.

- Track the outstanding branch change, and clear it once the tip has
  actually been shown rather than on the first attempt
- Send the list back to the branch tip whenever the sidebar is clicked,
  including a second click on the branch already selected
- Report from -selectCommit: whether the requested commit was found
- Add PBGitHistorySelectionTests over the reselect decision
Restore the commit the user picked once the history-list has been read
in, instead of leaving the list with nothing selected.

- Remember the OID behind the selection as it changes
- Re-select it after an update that found nothing owed to the sidebar,
  which is what a checkout leaves behind
- Cover both the restore and its precedence against a branch change
Follow a click on a ref label in the history-list with the matching
sidebar branch, so that the two views agree on which branch is being
looked at.

- Move the outline selection rather than writing to `currentBranch`, which
  the sidebar undoes as it preserves its own selection over the reload
- Pull the ref hit-testing out of the double-click handler, so both
  clicks read the label under the mouse the same way
Fix the history list selection fighting the sidebar branch
… Makefile

Give the project one place to run what CI runs, so that a build, a test
run or a local disk image is a single command rather than a remembered
xcodebuild invocation.

- Name the targets after the BuildPR.yml steps they mirror, so that a
  change on one side is visible from the other
- Keep `dmg` unsigned for local use and put signing behind `dmg-signed`,
  which wants an ExportOptions.plist of your own
- Point the README at `make help` alongside the build script shared in
  the discussion thread
Take the guesswork out of preparing a signable local build, so that a
contributor holding a certificate gets the settings that match it, and
one without is told exactly what is missing.

- Read the team and the identity off the certificate itself, as
  `security find-identity` reports nothing for a key that Xcode filed in
  the data protection keychain
- Name the cause on failure: no certificate, an expired one, or several
  teams to choose between
- Hang the target on the file, so a config edited by hand is never
  written over
Simplify building GitX outside of Xcode
git_repository_discover fills a git_buf whose asize is the allocated
capacity rather than the length of the path written into it, so the
copy took in whatever happened to follow the path in that allocation.

- Build the path with initWithBytes:length:encoding: over the buffer's
  size, dropping the NSData round-trip that existed only to hand a C
  string to stringWithUTF8String:
- Guard on the resulting path rather than on the allocation size, which
  was non-zero only because libgit2 owns the buffer it hands back
- Cover the finder for the first time: a repository root, a nested
  subdirectory, a directory outside any repository, and a non-file URL
Fix the git dir lookup reading past the discovered path
@hannesa2 hannesa2 changed the title [Test] fix discovered git dir length [Test only] fix discovered git dir length Sep 12, 2026
@hannesa2
hannesa2 force-pushed the test/fix-discovered-git-dir-length branch from e8340c0 to d2c8cf1 Compare September 12, 2026 05:34
@hannesa2 hannesa2 closed this Sep 12, 2026
@hannesa2
hannesa2 deleted the test/fix-discovered-git-dir-length branch September 12, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants