Skip to content

Rename methods with Get prefix #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (diff *Diff) NumDeltas() (int, error) {
return ret, nil
}

func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
func (diff *Diff) Delta(index int) (DiffDelta, error) {
if diff.ptr == nil {
return DiffDelta{}, ErrInvalid
}
Expand All @@ -154,6 +154,11 @@ func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
return ret, nil
}

// deprecated: You should use `Diff.Delta()` instead.
func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
return diff.Delta(index)
}

func newDiffFromC(ptr *C.git_diff, repo *Repository) *Diff {
if ptr == nil {
return nil
Expand Down
7 changes: 6 additions & 1 deletion index.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ type IndexConflict struct {
Their *IndexEntry
}

func (v *Index) GetConflict(path string) (IndexConflict, error) {
func (v *Index) Conflict(path string) (IndexConflict, error) {

var cancestor *C.git_index_entry
var cour *C.git_index_entry
Expand All @@ -553,6 +553,11 @@ func (v *Index) GetConflict(path string) (IndexConflict, error) {
return ret, nil
}

// deprecated: You should use `Index.Conflict()` instead.
func (v *Index) GetConflict(path string) (IndexConflict, error) {
return v.Conflict(path)
}

func (v *Index) RemoveConflict(path string) error {

cpath := C.CString(path)
Expand Down
2 changes: 1 addition & 1 deletion merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestMergeTreesWithoutAncestor(t *testing.T) {
if !index.HasConflicts() {
t.Fatal("expected conflicts in the index")
}
_, err = index.GetConflict("README")
_, err = index.Conflict("README")
checkFatal(t, err)

}
Expand Down
7 changes: 6 additions & 1 deletion settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ func EnableCaching(enabled bool) error {
}
}

func GetCachedMemory() (current int, allowed int, err error) {
func CachedMemory() (current int, allowed int, err error) {
return getSizetSizet(C.GIT_OPT_GET_CACHED_MEMORY)
}

// deprecated: You should use `CachedMemory()` instead.
func GetCachedMemory() (current int, allowed int, err error) {
return CachedMemory()
}

func SetCacheMaxSize(maxSize int) error {
return setSizet(C.GIT_OPT_SET_CACHE_MAX_SIZE, maxSize)
}
Expand Down
4 changes: 2 additions & 2 deletions settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func TestEnableCaching(t *testing.T) {
checkFatal(t, err)
}

func TestGetCachedMemory(t *testing.T) {
current, allowed, err := GetCachedMemory()
func TestCachedMemory(t *testing.T) {
current, allowed, err := CachedMemory()
checkFatal(t, err)

if current < 0 {
Expand Down