cleanup: consolidate all repo operations into Repository methods#125
Merged
cleanup: consolidate all repo operations into Repository methods#125
Conversation
4bca19f to
a61f34b
Compare
bd96e1e to
76eb453
Compare
This is a breaking change for v2 that removes all top-level functions that take repoPath as the first parameter. These functions have been consolidated into Repository methods. **Removed top-level functions (use Repository methods instead):** repo.go: - Push(repoPath, ...) → repo.Push(...) - Checkout(repoPath, ...) → repo.Checkout(...) - Reset(repoPath, ...) → repo.Reset(...) - Move(repoPath, ...) → repo.Move(...) - Add(repoPath, ...) → repo.Add(...) - CreateCommit(repoPath, ...) → repo.Commit(...) - ShowNameStatus(repoPath, ...) → repo.ShowNameStatus(...) - CountObjects(repoPath, ...) → repo.CountObjects(...) - Fsck(repoPath, ...) → repo.Fsck(...) repo_commit.go: - Log(repoPath, ...) → repo.Log(...) - DiffNameOnly(repoPath, ...) → repo.DiffNameOnly(...) repo_pull.go: - MergeBase(repoPath, ...) → repo.MergeBase(...) repo_reference.go: - ShowRefVerify(repoPath, ...) → repo.ShowRefVerify(...) - SymbolicRef(repoPath, ...) → repo.SymbolicRef(...) - DeleteBranch(repoPath, ...) → repo.DeleteBranch(...) - HasReference(repoPath, ...) → repo.HasReference(...) - HasBranch(repoPath, ...) → repo.HasBranch(...) - HasTag(repoPath, ...) → repo.HasTag(...) repo_remote.go: - RemoteAdd(repoPath, ...) → repo.RemoteAdd(...) - RemoteRemove(repoPath, ...) → repo.RemoteRemove(...) - Remotes(repoPath, ...) → repo.Remotes(...) - RemoteGetURL(repoPath, ...) → repo.RemoteGetURL(...) - RemoteSetURL(repoPath, ...) → repo.RemoteSetURL(...) - RemoteSetURLAdd(repoPath, ...) → repo.RemoteSetURLAdd(...) - RemoteSetURLDelete(repoPath, ...) → repo.RemoteSetURLDelete(...) repo_tag.go: - Tags(repoPath, ...) → repo.Tags(...) **Kept top-level functions (no repo required):** - Init(path, ...) - creates new repo - Clone(url, dst, ...) - clones repo - Open(repoPath) - opens repo **Stats:** 342 deletions, 80 insertions (-262 net lines) All tests updated and passing.
76eb453 to
6e87ef2
Compare
unknwon
commented
Feb 14, 2026
4d5f2af to
96df713
Compare
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.
Summary
This is a breaking change for v2 that consolidates the API by removing all redundant top-level functions that accept
repoPathas the first parameter. These functions have been moved directly intoRepositorymethods.Problem
The previous API had a confusing mix of:
Push(repoPath, remote, branch)repo.Push(remote, branch)RepoPush(repoPath, remote, branch)This tripled the API surface without adding value.
Solution
Removed 28 top-level functions - use Repository methods instead:
Push(repoPath, ...)repo.Push(...)Checkout(repoPath, ...)repo.Checkout(...)Reset(repoPath, ...)repo.Reset(...)Move(repoPath, ...)repo.Move(...)Add(repoPath, ...)repo.Add(...)CreateCommit(repoPath, ...)repo.Commit(...)ShowNameStatus(repoPath, ...)repo.ShowNameStatus(...)CountObjects(repoPath, ...)repo.CountObjects(...)Fsck(repoPath, ...)repo.Fsck(...)Log(repoPath, ...)repo.Log(...)DiffNameOnly(repoPath, ...)repo.DiffNameOnly(...)MergeBase(repoPath, ...)repo.MergeBase(...)ShowRefVerify(repoPath, ...)repo.ShowRefVerify(...)SymbolicRef(repoPath, ...)repo.SymbolicRef(...)DeleteBranch(repoPath, ...)repo.DeleteBranch(...)HasReference(repoPath, ...)repo.HasReference(...)HasBranch(repoPath, ...)repo.HasBranch(...)HasTag(repoPath, ...)repo.HasTag(...)RemoteAdd(repoPath, ...)repo.RemoteAdd(...)RemoteRemove(repoPath, ...)repo.RemoteRemove(...)Remotes(repoPath, ...)repo.Remotes(...)RemoteGetURL(repoPath, ...)repo.RemoteGetURL(...)RemoteSetURL(repoPath, ...)repo.RemoteSetURL(...)RemoteSetURLAdd(repoPath, ...)repo.RemoteSetURLAdd(...)RemoteSetURLDelete(repoPath, ...)repo.RemoteSetURLDelete(...)Tags(repoPath, ...)repo.Tags(...)Kept top-level functions (no repo required):
Init(path, ...)- creates new repoClone(url, dst, ...)- clones repoOpen(repoPath)- opens repoMigration Guide
Stats
Breaking Changes
This is a v2 breaking change. Any code using the removed top-level functions will need to be updated to use Repository methods.