Skip to content

Commit 31f877e

Browse files
authored
Merge pull request libgit2#582 from suhaibmujahid/method-rename
It is not Go idiomatic to put Get into the getter's name
2 parents 8b51d0d + cf6522c commit 31f877e

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

diff.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (diff *Diff) NumDeltas() (int, error) {
144144
return ret, nil
145145
}
146146

147-
func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
147+
func (diff *Diff) Delta(index int) (DiffDelta, error) {
148148
if diff.ptr == nil {
149149
return DiffDelta{}, ErrInvalid
150150
}
@@ -154,6 +154,11 @@ func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
154154
return ret, nil
155155
}
156156

157+
// deprecated: You should use `Diff.Delta()` instead.
158+
func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
159+
return diff.Delta(index)
160+
}
161+
157162
func newDiffFromC(ptr *C.git_diff, repo *Repository) *Diff {
158163
if ptr == nil {
159164
return nil

index.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ type IndexConflict struct {
528528
Their *IndexEntry
529529
}
530530

531-
func (v *Index) GetConflict(path string) (IndexConflict, error) {
531+
func (v *Index) Conflict(path string) (IndexConflict, error) {
532532

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

556+
// deprecated: You should use `Index.Conflict()` instead.
557+
func (v *Index) GetConflict(path string) (IndexConflict, error) {
558+
return v.Conflict(path)
559+
}
560+
556561
func (v *Index) RemoveConflict(path string) error {
557562

558563
cpath := C.CString(path)

merge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestMergeTreesWithoutAncestor(t *testing.T) {
109109
if !index.HasConflicts() {
110110
t.Fatal("expected conflicts in the index")
111111
}
112-
_, err = index.GetConflict("README")
112+
_, err = index.Conflict("README")
113113
checkFatal(t, err)
114114

115115
}

settings.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ func EnableCaching(enabled bool) error {
9393
}
9494
}
9595

96-
func GetCachedMemory() (current int, allowed int, err error) {
96+
func CachedMemory() (current int, allowed int, err error) {
9797
return getSizetSizet(C.GIT_OPT_GET_CACHED_MEMORY)
9898
}
9999

100+
// deprecated: You should use `CachedMemory()` instead.
101+
func GetCachedMemory() (current int, allowed int, err error) {
102+
return CachedMemory()
103+
}
104+
100105
func SetCacheMaxSize(maxSize int) error {
101106
return setSizet(C.GIT_OPT_SET_CACHE_MAX_SIZE, maxSize)
102107
}

settings_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func TestEnableCaching(t *testing.T) {
5757
checkFatal(t, err)
5858
}
5959

60-
func TestGetCachedMemory(t *testing.T) {
61-
current, allowed, err := GetCachedMemory()
60+
func TestCachedMemory(t *testing.T) {
61+
current, allowed, err := CachedMemory()
6262
checkFatal(t, err)
6363

6464
if current < 0 {

0 commit comments

Comments
 (0)