Skip to content

Commit 610c2cf

Browse files
committed
Remove all deprecated declarations
Now that we are introducing breaking API changes, let's get rid of all of the deprecated names that we've been accruing over the years.
1 parent 76acfbb commit 610c2cf

File tree

5 files changed

+1
-274
lines changed

5 files changed

+1
-274
lines changed

cherrypick.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import (
99
)
1010

1111
type CherrypickOptions struct {
12-
Version uint
1312
Mainline uint
1413
MergeOptions MergeOptions
1514
CheckoutOptions CheckoutOptions
1615
}
1716

1817
func cherrypickOptionsFromC(c *C.git_cherrypick_options) CherrypickOptions {
1918
opts := CherrypickOptions{
20-
Version: uint(c.version),
2119
Mainline: uint(c.mainline),
2220
MergeOptions: mergeOptionsFromC(&c.merge_opts),
2321
CheckoutOptions: checkoutOptionsFromC(&c.checkout_opts),

deprecated.go

Lines changed: 0 additions & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -1,271 +1,4 @@
11
package git
22

3-
/*
4-
#include <git2.h>
5-
*/
6-
import "C"
7-
import (
8-
"unsafe"
9-
)
10-
113
// The constants, functions, and types in this files are slated for deprecation
124
// in the next major version.
13-
14-
// blob.go
15-
16-
// Deprecated: BlobChunkCallback is not used.
17-
type BlobChunkCallback func(maxLen int) ([]byte, error)
18-
19-
// Deprecated: BlobCallbackData is not used.
20-
type BlobCallbackData struct {
21-
Callback BlobChunkCallback
22-
Error error
23-
}
24-
25-
// checkout.go
26-
27-
// Deprecated: CheckoutOpts is a deprecated alias of CheckoutOptions.
28-
type CheckoutOpts = CheckoutOptions
29-
30-
// credentials.go
31-
32-
// Deprecated: CredType is a deprecated alias of CredentialType
33-
type CredType = CredentialType
34-
35-
const (
36-
CredTypeUserpassPlaintext = CredentialTypeUserpassPlaintext
37-
CredTypeSshKey = CredentialTypeSSHKey
38-
CredTypeSshCustom = CredentialTypeSSHCustom
39-
CredTypeDefault = CredentialTypeDefault
40-
)
41-
42-
// Deprecated: Cred is a deprecated alias of Credential
43-
type Cred = Credential
44-
45-
// Deprecated: NewCredUsername is a deprecated alias of NewCredentialUsername.
46-
func NewCredUsername(username string) (*Cred, error) {
47-
return NewCredentialUsername(username)
48-
}
49-
50-
// Deprecated: NewCredUserpassPlaintext is a deprecated alias of NewCredentialUserpassPlaintext.
51-
func NewCredUserpassPlaintext(username string, password string) (*Cred, error) {
52-
return NewCredentialUserpassPlaintext(username, password)
53-
}
54-
55-
// Deprecated: NewCredSshKey is a deprecated alias of NewCredentialSshKey.
56-
func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (*Cred, error) {
57-
return NewCredentialSSHKey(username, publicKeyPath, privateKeyPath, passphrase)
58-
}
59-
60-
// Deprecated: NewCredSshKeyFromMemory is a deprecated alias of NewCredentialSSHKeyFromMemory.
61-
func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Cred, error) {
62-
return NewCredentialSSHKeyFromMemory(username, publicKey, privateKey, passphrase)
63-
}
64-
65-
// Deprecated: NewCredSshKeyFromAgent is a deprecated alias of NewCredentialSSHFromAgent.
66-
func NewCredSshKeyFromAgent(username string) (*Cred, error) {
67-
return NewCredentialSSHKeyFromAgent(username)
68-
}
69-
70-
// Deprecated: NewCredDefault is a deprecated alias fof NewCredentialDefault.
71-
func NewCredDefault() (*Cred, error) {
72-
return NewCredentialDefault()
73-
}
74-
75-
// diff.go
76-
77-
const (
78-
// Deprecated: DiffIgnoreWhitespaceEol is a deprecated alias of DiffIgnoreWhitespaceEOL.
79-
DiffIgnoreWitespaceEol = DiffIgnoreWhitespaceEOL
80-
)
81-
82-
// features.go
83-
84-
const (
85-
// Deprecated: FeatureHttps is a deprecated alias of FeatureHTTPS.
86-
FeatureHttps = FeatureHTTPS
87-
88-
// Deprecated: FeatureSsh is a deprecated alias of FeatureSSH.
89-
FeatureSsh = FeatureSSH
90-
)
91-
92-
// git.go
93-
94-
const (
95-
// Deprecated: ErrClassNone is a deprecated alias of ErrorClassNone.
96-
ErrClassNone = ErrorClassNone
97-
// Deprecated: ErrClassNoMemory is a deprecated alias of ErrorClassNoMemory.
98-
ErrClassNoMemory = ErrorClassNoMemory
99-
// Deprecated: ErrClassOs is a deprecated alias of ErrorClassOS.
100-
ErrClassOs = ErrorClassOS
101-
// Deprecated: ErrClassInvalid is a deprecated alias of ErrorClassInvalid.
102-
ErrClassInvalid = ErrorClassInvalid
103-
// Deprecated: ErrClassReference is a deprecated alias of ErrorClassReference.
104-
ErrClassReference = ErrorClassReference
105-
// Deprecated: ErrClassZlib is a deprecated alias of ErrorClassZlib.
106-
ErrClassZlib = ErrorClassZlib
107-
// Deprecated: ErrClassRepository is a deprecated alias of ErrorClassRepository.
108-
ErrClassRepository = ErrorClassRepository
109-
// Deprecated: ErrClassConfig is a deprecated alias of ErrorClassConfig.
110-
ErrClassConfig = ErrorClassConfig
111-
// Deprecated: ErrClassRegex is a deprecated alias of ErrorClassRegex.
112-
ErrClassRegex = ErrorClassRegex
113-
// Deprecated: ErrClassOdb is a deprecated alias of ErrorClassOdb.
114-
ErrClassOdb = ErrorClassOdb
115-
// Deprecated: ErrClassIndex is a deprecated alias of ErrorClassIndex.
116-
ErrClassIndex = ErrorClassIndex
117-
// Deprecated: ErrClassObject is a deprecated alias of ErrorClassObject.
118-
ErrClassObject = ErrorClassObject
119-
// Deprecated: ErrClassNet is a deprecated alias of ErrorClassNet.
120-
ErrClassNet = ErrorClassNet
121-
// Deprecated: ErrClassTag is a deprecated alias of ErrorClassTag.
122-
ErrClassTag = ErrorClassTag
123-
// Deprecated: ErrClassTree is a deprecated alias of ErrorClassTree.
124-
ErrClassTree = ErrorClassTree
125-
// Deprecated: ErrClassIndexer is a deprecated alias of ErrorClassIndexer.
126-
ErrClassIndexer = ErrorClassIndexer
127-
// Deprecated: ErrClassSSL is a deprecated alias of ErrorClassSSL.
128-
ErrClassSSL = ErrorClassSSL
129-
// Deprecated: ErrClassSubmodule is a deprecated alias of ErrorClassSubmodule.
130-
ErrClassSubmodule = ErrorClassSubmodule
131-
// Deprecated: ErrClassThread is a deprecated alias of ErrorClassThread.
132-
ErrClassThread = ErrorClassThread
133-
// Deprecated: ErrClassStash is a deprecated alias of ErrorClassStash.
134-
ErrClassStash = ErrorClassStash
135-
// Deprecated: ErrClassCheckout is a deprecated alias of ErrorClassCheckout.
136-
ErrClassCheckout = ErrorClassCheckout
137-
// Deprecated: ErrClassFetchHead is a deprecated alias of ErrorClassFetchHead.
138-
ErrClassFetchHead = ErrorClassFetchHead
139-
// Deprecated: ErrClassMerge is a deprecated alias of ErrorClassMerge.
140-
ErrClassMerge = ErrorClassMerge
141-
// Deprecated: ErrClassSsh is a deprecated alias of ErrorClassSSH.
142-
ErrClassSsh = ErrorClassSSH
143-
// Deprecated: ErrClassFilter is a deprecated alias of ErrorClassFilter.
144-
ErrClassFilter = ErrorClassFilter
145-
// Deprecated: ErrClassRevert is a deprecated alias of ErrorClassRevert.
146-
ErrClassRevert = ErrorClassRevert
147-
// Deprecated: ErrClassCallback is a deprecated alias of ErrorClassCallback.
148-
ErrClassCallback = ErrorClassCallback
149-
// Deprecated: ErrClassRebase is a deprecated alias of ErrorClassRebase.
150-
ErrClassRebase = ErrorClassRebase
151-
// Deprecated: ErrClassPatch is a deprecated alias of ErrorClassPatch.
152-
ErrClassPatch = ErrorClassPatch
153-
)
154-
155-
const (
156-
// Deprecated: ErrOk is a deprecated alias of ErrorCodeOK.
157-
ErrOk = ErrorCodeOK
158-
// Deprecated: ErrGeneric is a deprecated alias of ErrorCodeGeneric.
159-
ErrGeneric = ErrorCodeGeneric
160-
// Deprecated: ErrNotFound is a deprecated alias of ErrorCodeNotFound.
161-
ErrNotFound = ErrorCodeNotFound
162-
// Deprecated: ErrExists is a deprecated alias of ErrorCodeExists.
163-
ErrExists = ErrorCodeExists
164-
// Deprecated: ErrAmbiguous is a deprecated alias of ErrorCodeAmbiguous.
165-
ErrAmbiguous = ErrorCodeAmbiguous
166-
// Deprecated: ErrAmbigious is a deprecated alias of ErrorCodeAmbiguous.
167-
ErrAmbigious = ErrorCodeAmbiguous
168-
// Deprecated: ErrBuffs is a deprecated alias of ErrorCodeBuffs.
169-
ErrBuffs = ErrorCodeBuffs
170-
// Deprecated: ErrUser is a deprecated alias of ErrorCodeUser.
171-
ErrUser = ErrorCodeUser
172-
// Deprecated: ErrBareRepo is a deprecated alias of ErrorCodeBareRepo.
173-
ErrBareRepo = ErrorCodeBareRepo
174-
// Deprecated: ErrUnbornBranch is a deprecated alias of ErrorCodeUnbornBranch.
175-
ErrUnbornBranch = ErrorCodeUnbornBranch
176-
// Deprecated: ErrUnmerged is a deprecated alias of ErrorCodeUnmerged.
177-
ErrUnmerged = ErrorCodeUnmerged
178-
// Deprecated: ErrNonFastForward is a deprecated alias of ErrorCodeNonFastForward.
179-
ErrNonFastForward = ErrorCodeNonFastForward
180-
// Deprecated: ErrInvalidSpec is a deprecated alias of ErrorCodeInvalidSpec.
181-
ErrInvalidSpec = ErrorCodeInvalidSpec
182-
// Deprecated: ErrConflict is a deprecated alias of ErrorCodeConflict.
183-
ErrConflict = ErrorCodeConflict
184-
// Deprecated: ErrLocked is a deprecated alias of ErrorCodeLocked.
185-
ErrLocked = ErrorCodeLocked
186-
// Deprecated: ErrModified is a deprecated alias of ErrorCodeModified.
187-
ErrModified = ErrorCodeModified
188-
// Deprecated: ErrAuth is a deprecated alias of ErrorCodeAuth.
189-
ErrAuth = ErrorCodeAuth
190-
// Deprecated: ErrCertificate is a deprecated alias of ErrorCodeCertificate.
191-
ErrCertificate = ErrorCodeCertificate
192-
// Deprecated: ErrApplied is a deprecated alias of ErrorCodeApplied.
193-
ErrApplied = ErrorCodeApplied
194-
// Deprecated: ErrPeel is a deprecated alias of ErrorCodePeel.
195-
ErrPeel = ErrorCodePeel
196-
// Deprecated: ErrEOF is a deprecated alias of ErrorCodeEOF.
197-
ErrEOF = ErrorCodeEOF
198-
// Deprecated: ErrUncommitted is a deprecated alias of ErrorCodeUncommitted.
199-
ErrUncommitted = ErrorCodeUncommitted
200-
// Deprecated: ErrDirectory is a deprecated alias of ErrorCodeDirectory.
201-
ErrDirectory = ErrorCodeDirectory
202-
// Deprecated: ErrMergeConflict is a deprecated alias of ErrorCodeMergeConflict.
203-
ErrMergeConflict = ErrorCodeMergeConflict
204-
// Deprecated: ErrPassthrough is a deprecated alias of ErrorCodePassthrough.
205-
ErrPassthrough = ErrorCodePassthrough
206-
// Deprecated: ErrIterOver is a deprecated alias of ErrorCodeIterOver.
207-
ErrIterOver = ErrorCodeIterOver
208-
// Deprecated: ErrApplyFail is a deprecated alias of ErrorCodeApplyFail.
209-
ErrApplyFail = ErrorCodeApplyFail
210-
)
211-
212-
// index.go
213-
214-
// Deprecated: IndexAddOpts is a deprecated alias of IndexAddOption.
215-
type IndexAddOpts = IndexAddOption
216-
217-
// Deprecated: IndexStageOpts is a deprecated alias of IndexStageState.
218-
type IndexStageOpts = IndexStageState
219-
220-
// submodule.go
221-
222-
// Deprecated: SubmoduleCbk is a deprecated alias of SubmoduleCallback.
223-
type SubmoduleCbk = SubmoduleCallback
224-
225-
// Deprecated: SubmoduleVisitor is not used.
226-
func SubmoduleVisitor(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer) C.int {
227-
sub := &Submodule{(*C.git_submodule)(csub), nil}
228-
229-
callback, ok := pointerHandles.Get(handle).(SubmoduleCallback)
230-
if !ok {
231-
panic("invalid submodule visitor callback")
232-
}
233-
err := callback(sub, C.GoString(name))
234-
if err != nil {
235-
return C.int(ErrorCodeUser)
236-
}
237-
return C.int(ErrorCodeOK)
238-
}
239-
240-
// reference.go
241-
242-
// Deprecated: ReferenceIsValidName is a deprecated alias of ReferenceNameIsValid.
243-
func ReferenceIsValidName(name string) bool {
244-
valid, _ := ReferenceNameIsValid(name)
245-
return valid
246-
}
247-
248-
// remote.go
249-
250-
// Deprecated: RemoteIsValidName is a deprecated alias of RemoteNameIsValid.
251-
func RemoteIsValidName(name string) bool {
252-
valid, _ := RemoteNameIsValid(name)
253-
return valid
254-
}
255-
256-
// tree.go
257-
258-
// Deprecated: CallbackGitTreeWalk is not used.
259-
func CallbackGitTreeWalk(_root *C.char, entry *C.git_tree_entry, ptr unsafe.Pointer) C.int {
260-
root := C.GoString(_root)
261-
262-
callback, ok := pointerHandles.Get(ptr).(TreeWalkCallback)
263-
if !ok {
264-
panic("invalid treewalk callback")
265-
}
266-
err := callback(root, newTreeEntry(entry))
267-
if err != nil {
268-
return C.int(ErrorCodeUser)
269-
}
270-
return C.int(ErrorCodeOK)
271-
}

git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func NewOid(s string) (*Oid, error) {
206206
}
207207

208208
if len(slice) != 20 {
209-
return nil, &GitError{"Invalid Oid", ErrorClassNone, ErrGeneric}
209+
return nil, &GitError{"invalid oid", ErrorClassNone, ErrorCodeGeneric}
210210
}
211211

212212
copy(o[:], slice[:20])

merge.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ const (
137137
)
138138

139139
type MergeOptions struct {
140-
Version uint
141140
TreeFlags MergeTreeFlag
142141

143142
RenameThreshold uint
@@ -150,7 +149,6 @@ type MergeOptions struct {
150149

151150
func mergeOptionsFromC(opts *C.git_merge_options) MergeOptions {
152151
return MergeOptions{
153-
Version: uint(opts.version),
154152
TreeFlags: MergeTreeFlag(opts.flags),
155153
RenameThreshold: uint(opts.rename_threshold),
156154
TargetLimit: uint(opts.target_limit),

rebase.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ func commitCreateCallback(
183183

184184
// RebaseOptions are used to tell the rebase machinery how to operate.
185185
type RebaseOptions struct {
186-
Version uint
187186
Quiet int
188187
InMemory int
189188
RewriteNotesRef string
@@ -226,7 +225,6 @@ func DefaultRebaseOptions() (RebaseOptions, error) {
226225

227226
func rebaseOptionsFromC(opts *C.git_rebase_options) RebaseOptions {
228227
return RebaseOptions{
229-
Version: uint(opts.version),
230228
Quiet: int(opts.quiet),
231229
InMemory: int(opts.inmemory),
232230
RewriteNotesRef: C.GoString(opts.rewrite_notes_ref),

0 commit comments

Comments
 (0)