diff options
| author | lhchavez <[email protected]> | 2020-12-05 07:23:44 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-05 07:23:44 -0800 |
| commit | 137c05e802d5e11a5ab54809bc8be8f61ccece21 (patch) | |
| tree | b44997824565f9506744a4259177746b83112e92 /deprecated.go | |
| parent | 1fabe95fb7275df980ff6ab03fb85eac91c5849d (diff) | |
Mark some symbols to be deprecated #minor (#698)
This change introduces the file deprecated.go, which contains any
constants, functions, and types that are slated to be deprecated in the
next major release.
These symbols are deprecated because they refer to old spellings in
pre-1.0 libgit2. This also makes the build be done with the
`-DDEPRECATE_HARD` flag to avoid regressions.
This, together with
[gorelease](https://godoc.org/golang.org/x/exp/cmd/gorelease)[1] should
make releases safer going forward.
1: More information about how that works at
https://go.googlesource.com/exp/+/refs/heads/master/apidiff/README.md
Diffstat (limited to 'deprecated.go')
| -rw-r--r-- | deprecated.go | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/deprecated.go b/deprecated.go new file mode 100644 index 0000000..ae277f1 --- /dev/null +++ b/deprecated.go @@ -0,0 +1,184 @@ +package git + +/* +#include <git2.h> +*/ +import "C" +import ( + "unsafe" +) + +// The constants, functions, and types in this files are slated for deprecation +// in the next major version. + +// blob.go + +// BlobChunkCallback is not used. +type BlobChunkCallback func(maxLen int) ([]byte, error) + +// BlobCallbackData is not used. +type BlobCallbackData struct { + Callback BlobChunkCallback + Error error +} + +// checkout.go + +// CheckoutOpts is a deprecated alias of CheckoutOptions. +type CheckoutOpts = CheckoutOptions + +// credentials.go + +// CredType is a deprecated alias of CredentialType +type CredType = CredentialType + +const ( + CredTypeUserpassPlaintext = CredentialTypeUserpassPlaintext + CredTypeSshKey = CredentialTypeSSHKey + CredTypeSshCustom = CredentialTypeSSHCustom + CredTypeDefault = CredentialTypeDefault +) + +// Cred is a deprecated alias of Credential +type Cred = Credential + +// NewCredUsername is a deprecated alias of NewCredentialUsername. +func NewCredUsername(username string) (*Cred, error) { + return NewCredentialUsername(username) +} + +// NewCredUserpassPlaintext is a deprecated alias of NewCredentialUserpassPlaintext. +func NewCredUserpassPlaintext(username string, password string) (*Cred, error) { + return NewCredentialUserpassPlaintext(username, password) +} + +// NewCredSshKey is a deprecated alias of NewCredentialSshKey. +func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (*Cred, error) { + return NewCredentialSSHKey(username, publicKeyPath, privateKeyPath, passphrase) +} + +// NewCredSshKeyFromMemory is a deprecated alias of NewCredentialSSHKeyFromMemory. +func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Cred, error) { + return NewCredentialSSHKeyFromMemory(username, publicKey, privateKey, passphrase) +} + +// NewCredSshKeyFromAgent is a deprecated alias of NewCredentialSSHFromAgent. +func NewCredSshKeyFromAgent(username string) (*Cred, error) { + return NewCredentialSSHKeyFromAgent(username) +} + +// NewCredDefault is a deprecated alias fof NewCredentialDefault. +func NewCredDefault() (*Cred, error) { + return NewCredentialDefault() +} + +// features.go + +const ( + // FeatureHttps is a deprecated alias of FeatureHTTPS. + FeatureHttps = FeatureHTTPS + + // FeatureSsh is a deprecated alias of FeatureSSH. + FeatureSsh = FeatureSSH +) + +// git.go + +const ( + ErrClassNone = ErrorClassNone + ErrClassNoMemory = ErrorClassNoMemory + ErrClassOs = ErrorClassOS + ErrClassInvalid = ErrorClassInvalid + ErrClassReference = ErrorClassReference + ErrClassZlib = ErrorClassZlib + ErrClassRepository = ErrorClassRepository + ErrClassConfig = ErrorClassConfig + ErrClassRegex = ErrorClassRegex + ErrClassOdb = ErrorClassOdb + ErrClassIndex = ErrorClassIndex + ErrClassObject = ErrorClassObject + ErrClassNet = ErrorClassNet + ErrClassTag = ErrorClassTag + ErrClassTree = ErrorClassTree + ErrClassIndexer = ErrorClassIndexer + ErrClassSSL = ErrorClassSSL + ErrClassSubmodule = ErrorClassSubmodule + ErrClassThread = ErrorClassThread + ErrClassStash = ErrorClassStash + ErrClassCheckout = ErrorClassCheckout + ErrClassFetchHead = ErrorClassFetchHead + ErrClassMerge = ErrorClassMerge + ErrClassSsh = ErrorClassSSH + ErrClassFilter = ErrorClassFilter + ErrClassRevert = ErrorClassRevert + ErrClassCallback = ErrorClassCallback + ErrClassRebase = ErrorClassRebase + ErrClassPatch = ErrorClassPatch +) + +const ( + ErrOk = ErrorCodeOK + ErrGeneric = ErrorCodeGeneric + ErrNotFound = ErrorCodeNotFound + ErrExists = ErrorCodeExists + ErrAmbiguous = ErrorCodeAmbiguous + ErrAmbigious = ErrorCodeAmbiguous + ErrBuffs = ErrorCodeBuffs + ErrUser = ErrorCodeUser + ErrBareRepo = ErrorCodeBareRepo + ErrUnbornBranch = ErrorCodeUnbornBranch + ErrUnmerged = ErrorCodeUnmerged + ErrNonFastForward = ErrorCodeNonFastForward + ErrInvalidSpec = ErrorCodeInvalidSpec + ErrConflict = ErrorCodeConflict + ErrLocked = ErrorCodeLocked + ErrModified = ErrorCodeModified + ErrAuth = ErrorCodeAuth + ErrCertificate = ErrorCodeCertificate + ErrApplied = ErrorCodeApplied + ErrPeel = ErrorCodePeel + ErrEOF = ErrorCodeEOF + ErrUncommitted = ErrorCodeUncommitted + ErrDirectory = ErrorCodeDirectory + ErrMergeConflict = ErrorCodeMergeConflict + ErrPassthrough = ErrorCodePassthrough + ErrIterOver = ErrorCodeIterOver + ErrApplyFail = ErrorCodeApplyFail +) + +// index.go + +// IndexAddOpts is a deprecated alias of IndexAddOption. +type IndexAddOpts = IndexAddOption + +// IndexStageOpts is a deprecated alias of IndexStageState. +type IndexStageOpts = IndexStageState + +// submodule.go + +// SubmoduleCbk is a deprecated alias of SubmoduleCallback. +type SubmoduleCbk = SubmoduleCallback + +// SubmoduleVisitor is not used. +func SubmoduleVisitor(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer) C.int { + sub := &Submodule{(*C.git_submodule)(csub), nil} + + callback, ok := pointerHandles.Get(handle).(SubmoduleCallback) + if !ok { + panic("invalid submodule visitor callback") + } + return (C.int)(callback(sub, C.GoString(name))) +} + +// tree.go + +// CallbackGitTreeWalk is not used. +func CallbackGitTreeWalk(_root *C.char, entry *C.git_tree_entry, ptr unsafe.Pointer) C.int { + root := C.GoString(_root) + + if callback, ok := pointerHandles.Get(ptr).(TreeWalkCallback); ok { + return C.int(callback(root, newTreeEntry(entry))) + } else { + panic("invalid treewalk callback") + } +} |
