Skip to content

fix deprecated libgit2 API usage in gitdir discovery - #761

Merged
hannesa2 merged 2 commits into
masterfrom
deprecatedLibgit2APIusage
Oct 7, 2026
Merged

hannesa2 merged 2 commits into
masterfrom
deprecatedLibgit2APIusage

Conversation

@hannesa2

@hannesa2 hannesa2 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

It's the last take away from #559
close #559

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The GitRepoFinder conversion drops the required NUL terminator before passing bytes to stringWithUTF8String:.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Modernizes git-directory discovery for current libgit2 buffer APIs.

Changes:

  • Replaces deprecated git_buf_free with git_buf_dispose.
  • Replaces removed asize usage with size.
File Description
Classes/​git/​PBRepositoryFinder.m Updates buffer disposal.
Classes/​git/​GitRepoFinder.m Updates buffer size and disposal APIs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Classes/git/GitRepoFinder.m Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changes correctly follow the current git_buf ownership and length contract.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@goneng goneng left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannesa2 , The PBRepositoryFinder.m change looks good.

For GitRepoFinder.m, consider deleting it instead:
it has been orphaned since commit 8e2e25b (from 2014) renamed the class to PBRepositoryFinder.
It is not in the Xcode project, has no header, and nothing references it.
The old asize field doesn't exist in libgit2 1.9, so it never compiled, and
Copilot's finding and the autofix commit only touch code that never runs.
Removing the file would leave a single commit like
"Replace deprecated git_buf_free and drop orphaned GitRepoFinder.m".

@hannesa2
hannesa2 force-pushed the deprecatedLibgit2APIusage branch from 44407c4 to f08332b Compare October 7, 2026 04:43
@hannesa2

hannesa2 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Screenshot differs: emulatorApi=arm64 with 2 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

commit-context-menu.pngscreenshot

history-view.pngscreenshot

@hannesa2

hannesa2 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

I was just wondering, why this issue was still there in GitRepoFinder.m
Thank you for the catch. I applied your suggestion

@hannesa2
hannesa2 merged commit cd87cb3 into master Oct 7, 2026
3 checks passed
@hannesa2
hannesa2 deleted the deprecatedLibgit2APIusage branch October 7, 2026 05:31
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.

3 participants