Skip to content

Commit a84e8c0

Browse files
committed
cleanup: remove deprecated RepoXxx wrapper functions
Remove all deprecated functions that were marked with // Deprecated: Use Xxx instead. These were wrapper functions that provided no additional value over the top-level functions or Repository methods. Removed functions: - RepoPush, RepoCheckout, RepoReset, RepoMove, RepoAdd, RepoCommit - RepoShowNameStatus, RepoCountObjects, RepoFsck - RepoLog, RepoDiffNameOnly - RepoShowRefVerify, RepoHasTag, RepoDeleteBranch - RepoAddRemote, RepoRemoveRemote, RepoMergeBase - AddRemoteOptions type alias, RemoveRemoteOptions type alias - Repository.AddRemote, Repository.RemoveRemote methods This reduces the API surface and eliminates tech debt for v2.
1 parent 20722b9 commit a84e8c0

5 files changed

Lines changed: 0 additions & 101 deletions

File tree

repo.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ func Push(repoPath, remote, branch string, opts ...PushOptions) error {
266266
return err
267267
}
268268

269-
// Deprecated: Use Push instead.
270-
func RepoPush(repoPath, remote, branch string, opts ...PushOptions) error {
271-
return Push(repoPath, remote, branch, opts...)
272-
}
273-
274269
// Push pushes local changes to given remote and branch for the repository.
275270
func (r *Repository) Push(remote, branch string, opts ...PushOptions) error {
276271
return Push(r.path, remote, branch, opts...)
@@ -311,11 +306,6 @@ func Checkout(repoPath, branch string, opts ...CheckoutOptions) error {
311306
return err
312307
}
313308

314-
// Deprecated: Use Checkout instead.
315-
func RepoCheckout(repoPath, branch string, opts ...CheckoutOptions) error {
316-
return Checkout(repoPath, branch, opts...)
317-
}
318-
319309
// Checkout checks out to given branch for the repository.
320310
func (r *Repository) Checkout(branch string, opts ...CheckoutOptions) error {
321311
return Checkout(r.path, branch, opts...)
@@ -352,11 +342,6 @@ func Reset(repoPath, rev string, opts ...ResetOptions) error {
352342
return err
353343
}
354344

355-
// Deprecated: Use Reset instead.
356-
func RepoReset(repoPath, rev string, opts ...ResetOptions) error {
357-
return Reset(repoPath, rev, opts...)
358-
}
359-
360345
// Reset resets working tree to given revision for the repository.
361346
func (r *Repository) Reset(rev string, opts ...ResetOptions) error {
362347
return Reset(r.path, rev, opts...)
@@ -388,11 +373,6 @@ func Move(repoPath, src, dst string, opts ...MoveOptions) error {
388373
return err
389374
}
390375

391-
// Deprecated: Use Move instead.
392-
func RepoMove(repoPath, src, dst string, opts ...MoveOptions) error {
393-
return Move(repoPath, src, dst, opts...)
394-
}
395-
396376
// Move moves a file, a directory, or a symlink file or directory from source to
397377
// destination for the repository.
398378
func (r *Repository) Move(src, dst string, opts ...MoveOptions) error {
@@ -435,11 +415,6 @@ func Add(repoPath string, opts ...AddOptions) error {
435415
return err
436416
}
437417

438-
// Deprecated: Use Add instead.
439-
func RepoAdd(repoPath string, opts ...AddOptions) error {
440-
return Add(repoPath, opts...)
441-
}
442-
443418
// Add adds local changes to index for the repository.
444419
func (r *Repository) Add(opts ...AddOptions) error {
445420
return Add(r.path, opts...)
@@ -486,11 +461,6 @@ func CreateCommit(repoPath string, committer *Signature, message string, opts ..
486461
return err
487462
}
488463

489-
// Deprecated: Use CreateCommit instead.
490-
func RepoCommit(repoPath string, committer *Signature, message string, opts ...CommitOptions) error {
491-
return CreateCommit(repoPath, committer, message, opts...)
492-
}
493-
494464
// Commit commits local changes with given author, committer and message for the
495465
// repository.
496466
func (r *Repository) Commit(committer *Signature, message string, opts ...CommitOptions) error {
@@ -562,11 +532,6 @@ func ShowNameStatus(repoPath, rev string, opts ...ShowNameStatusOptions) (*NameS
562532
return fileStatus, nil
563533
}
564534

565-
// Deprecated: Use ShowNameStatus instead.
566-
func RepoShowNameStatus(repoPath, rev string, opts ...ShowNameStatusOptions) (*NameStatus, error) {
567-
return ShowNameStatus(repoPath, rev, opts...)
568-
}
569-
570535
// ShowNameStatus returns name status of given revision of the repository.
571536
func (r *Repository) ShowNameStatus(rev string, opts ...ShowNameStatusOptions) (*NameStatus, error) {
572537
return ShowNameStatus(r.path, rev, opts...)
@@ -675,11 +640,6 @@ func CountObjects(repoPath string, opts ...CountObjectsOptions) (*CountObject, e
675640
return countObject, nil
676641
}
677642

678-
// Deprecated: Use CountObjects instead.
679-
func RepoCountObjects(repoPath string, opts ...CountObjectsOptions) (*CountObject, error) {
680-
return CountObjects(repoPath, opts...)
681-
}
682-
683643
// CountObjects returns disk usage report of the repository.
684644
func (r *Repository) CountObjects(opts ...CountObjectsOptions) (*CountObject, error) {
685645
return CountObjects(r.path, opts...)
@@ -711,11 +671,6 @@ func Fsck(repoPath string, opts ...FsckOptions) error {
711671
return err
712672
}
713673

714-
// Deprecated: Use Fsck instead.
715-
func RepoFsck(repoPath string, opts ...FsckOptions) error {
716-
return Fsck(repoPath, opts...)
717-
}
718-
719674
// Fsck verifies the connectivity and validity of the objects in the database
720675
// for the repository.
721676
func (r *Repository) Fsck(opts ...FsckOptions) error {

repo_commit.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,6 @@ func Log(repoPath, rev string, opts ...LogOptions) ([]*Commit, error) {
206206
return r.Log(rev, opts...)
207207
}
208208

209-
// Deprecated: Use Log instead.
210-
func RepoLog(repoPath, rev string, opts ...LogOptions) ([]*Commit, error) {
211-
return Log(repoPath, rev, opts...)
212-
}
213-
214209
// Log returns a list of commits in the state of given revision of the repository.
215210
// The returned list is in reverse chronological order.
216211
func (r *Repository) Log(rev string, opts ...LogOptions) ([]*Commit, error) {
@@ -434,11 +429,6 @@ func DiffNameOnly(repoPath, base, head string, opts ...DiffNameOnlyOptions) ([]s
434429
return names, nil
435430
}
436431

437-
// Deprecated: Use DiffNameOnly instead.
438-
func RepoDiffNameOnly(repoPath, base, head string, opts ...DiffNameOnlyOptions) ([]string, error) {
439-
return DiffNameOnly(repoPath, base, head, opts...)
440-
}
441-
442432
// DiffNameOnly returns a list of changed files between base and head revisions of the
443433
// repository.
444434
func (r *Repository) DiffNameOnly(base, head string, opts ...DiffNameOnlyOptions) ([]string, error) {

repo_pull.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func MergeBase(repoPath, base, head string, opts ...MergeBaseOptions) (string, e
4646
return strings.TrimSpace(string(stdout)), nil
4747
}
4848

49-
// Deprecated: Use MergeBase instead.
50-
func RepoMergeBase(repoPath, base, head string, opts ...MergeBaseOptions) (string, error) {
51-
return MergeBase(repoPath, base, head, opts...)
52-
}
53-
5449
// MergeBase returns merge base between base and head revisions of the
5550
// repository.
5651
func (r *Repository) MergeBase(base, head string, opts ...MergeBaseOptions) (string, error) {

repo_reference.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ func ShowRefVerify(repoPath, ref string, opts ...ShowRefVerifyOptions) (string,
6767
return strings.Split(string(stdout), " ")[0], nil
6868
}
6969

70-
// Deprecated: Use ShowRefVerify instead.
71-
func RepoShowRefVerify(repoPath, ref string, opts ...ShowRefVerifyOptions) (string, error) {
72-
return ShowRefVerify(repoPath, ref, opts...)
73-
}
74-
7570
// ShowRefVerify returns the commit ID of given reference (e.g.
7671
// "refs/heads/master") if it exists in the repository.
7772
func (r *Repository) ShowRefVerify(ref string, opts ...ShowRefVerifyOptions) (string, error) {
@@ -110,11 +105,6 @@ func HasTag(repoPath, tag string, opts ...ShowRefVerifyOptions) bool {
110105
return RepoHasReference(repoPath, RefsTags+tag, opts...)
111106
}
112107

113-
// Deprecated: Use HasTag instead.
114-
func RepoHasTag(repoPath, tag string, opts ...ShowRefVerifyOptions) bool {
115-
return HasTag(repoPath, tag, opts...)
116-
}
117-
118108
// HasReference returns true if given reference exists in the repository. The
119109
// reference must be given in full refspec, e.g. "refs/heads/master".
120110
func (r *Repository) HasReference(ref string, opts ...ShowRefVerifyOptions) bool {
@@ -285,11 +275,6 @@ func DeleteBranch(repoPath, name string, opts ...DeleteBranchOptions) error {
285275
return err
286276
}
287277

288-
// Deprecated: Use DeleteBranch instead.
289-
func RepoDeleteBranch(repoPath, name string, opts ...DeleteBranchOptions) error {
290-
return DeleteBranch(repoPath, name, opts...)
291-
}
292-
293278
// DeleteBranch deletes the branch from the repository.
294279
func (r *Repository) DeleteBranch(name string, opts ...DeleteBranchOptions) error {
295280
return DeleteBranch(r.path, name, opts...)

repo_remote.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ type RemoteAddOptions struct {
103103
CommandOptions
104104
}
105105

106-
// Deprecated: Use RemoteAddOptions instead.
107-
type AddRemoteOptions = RemoteAddOptions
108-
109106
// RemoteAdd adds a new remote to the repository in given path.
110107
func RemoteAdd(repoPath, name, url string, opts ...RemoteAddOptions) error {
111108
var opt RemoteAddOptions
@@ -125,21 +122,11 @@ func RemoteAdd(repoPath, name, url string, opts ...RemoteAddOptions) error {
125122
return err
126123
}
127124

128-
// Deprecated: Use RemoteAdd instead.
129-
func RepoAddRemote(repoPath, name, url string, opts ...RemoteAddOptions) error {
130-
return RemoteAdd(repoPath, name, url, opts...)
131-
}
132-
133125
// RemoteAdd adds a new remote to the repository.
134126
func (r *Repository) RemoteAdd(name, url string, opts ...RemoteAddOptions) error {
135127
return RemoteAdd(r.path, name, url, opts...)
136128
}
137129

138-
// Deprecated: Use RemoteAdd instead.
139-
func (r *Repository) AddRemote(name, url string, opts ...RemoteAddOptions) error {
140-
return RemoteAdd(r.path, name, url, opts...)
141-
}
142-
143130
// RemoteRemoveOptions contains arguments for removing a remote from the
144131
// repository.
145132
//
@@ -154,9 +141,6 @@ type RemoteRemoveOptions struct {
154141
CommandOptions
155142
}
156143

157-
// Deprecated: Use RemoteRemoveOptions instead.
158-
type RemoveRemoteOptions = RemoteRemoveOptions
159-
160144
// RemoteRemove removes a remote from the repository in given path.
161145
func RemoteRemove(repoPath, name string, opts ...RemoteRemoveOptions) error {
162146
var opt RemoteRemoveOptions
@@ -179,21 +163,11 @@ func RemoteRemove(repoPath, name string, opts ...RemoteRemoveOptions) error {
179163
return nil
180164
}
181165

182-
// Deprecated: Use RemoteRemove instead.
183-
func RepoRemoveRemote(repoPath, name string, opts ...RemoteRemoveOptions) error {
184-
return RemoteRemove(repoPath, name, opts...)
185-
}
186-
187166
// RemoteRemove removes a remote from the repository.
188167
func (r *Repository) RemoteRemove(name string, opts ...RemoteRemoveOptions) error {
189168
return RemoteRemove(r.path, name, opts...)
190169
}
191170

192-
// Deprecated: Use RemoteRemove instead.
193-
func (r *Repository) RemoveRemote(name string, opts ...RemoteRemoveOptions) error {
194-
return RemoteRemove(r.path, name, opts...)
195-
}
196-
197171
// RemotesOptions contains arguments for listing remotes of the repository.
198172
// /
199173
// Docs: https://git-scm.com/docs/git-remote#_commands

0 commit comments

Comments
 (0)