From 137c05e802d5e11a5ab54809bc8be8f61ccece21 Mon Sep 17 00:00:00 2001 From: lhchavez Date: Sat, 5 Dec 2020 07:23:44 -0800 Subject: 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 --- index.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'index.go') diff --git a/index.go b/index.go index 150abf2..61d5d82 100644 --- a/index.go +++ b/index.go @@ -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) -- cgit v1.2.3