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 /index.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 'index.go')
| -rw-r--r-- | index.go | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -17,31 +17,33 @@ import ( type IndexMatchedPathCallback func(string, string) int -type IndexAddOpts uint +// IndexAddOption is a set of flags for APIs that add files matching pathspec. +type IndexAddOption uint const ( - IndexAddDefault IndexAddOpts = C.GIT_INDEX_ADD_DEFAULT - IndexAddForce IndexAddOpts = C.GIT_INDEX_ADD_FORCE - IndexAddDisablePathspecMatch IndexAddOpts = C.GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH - IndexAddCheckPathspec IndexAddOpts = C.GIT_INDEX_ADD_CHECK_PATHSPEC + IndexAddDefault IndexAddOption = C.GIT_INDEX_ADD_DEFAULT + IndexAddForce IndexAddOption = C.GIT_INDEX_ADD_FORCE + IndexAddDisablePathspecMatch IndexAddOption = C.GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH + IndexAddCheckPathspec IndexAddOption = C.GIT_INDEX_ADD_CHECK_PATHSPEC ) -type IndexStageOpts int +// IndexStageState indicates the state of the git index. +type IndexStageState int const ( // IndexStageAny matches any index stage. // // Some index APIs take a stage to match; pass this value to match // any entry matching the path regardless of stage. - IndexStageAny IndexStageOpts = C.GIT_INDEX_STAGE_ANY + IndexStageAny IndexStageState = C.GIT_INDEX_STAGE_ANY // IndexStageNormal is a normal staged file in the index. - IndexStageNormal IndexStageOpts = C.GIT_INDEX_STAGE_NORMAL + IndexStageNormal IndexStageState = C.GIT_INDEX_STAGE_NORMAL // IndexStageAncestor is the ancestor side of a conflict. - IndexStageAncestor IndexStageOpts = C.GIT_INDEX_STAGE_ANCESTOR + IndexStageAncestor IndexStageState = C.GIT_INDEX_STAGE_ANCESTOR // IndexStageOurs is the "ours" side of a conflict. - IndexStageOurs IndexStageOpts = C.GIT_INDEX_STAGE_OURS + IndexStageOurs IndexStageState = C.GIT_INDEX_STAGE_OURS // IndexStageTheirs is the "theirs" side of a conflict. - IndexStageTheirs IndexStageOpts = C.GIT_INDEX_STAGE_THEIRS + IndexStageTheirs IndexStageState = C.GIT_INDEX_STAGE_THEIRS ) type Index struct { @@ -219,7 +221,7 @@ func (v *Index) AddFromBuffer(entry *IndexEntry, buffer []byte) error { return nil } -func (v *Index) AddAll(pathspecs []string, flags IndexAddOpts, callback IndexMatchedPathCallback) error { +func (v *Index) AddAll(pathspecs []string, flags IndexAddOption, callback IndexMatchedPathCallback) error { cpathspecs := C.git_strarray{} cpathspecs.count = C.size_t(len(pathspecs)) cpathspecs.strings = makeCStringsFromStrings(pathspecs) |
