summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-05-09 20:39:51 -0700
committerGitHub <[email protected]>2020-05-09 20:39:51 -0700
commit31f877e249e28c29cc4fcd512381a5a5b26e59d9 (patch)
treeeba9030b1449cddf6274b748fbfcf010680d35cd
parent8b51d0db8e40e97283b771a5a51b13bea4651f81 (diff)
parentcf6522c7fe093244a14334ced1c90c9791231a3e (diff)
Merge pull request #582 from suhaibmujahid/method-rename
It is not Go idiomatic to put Get into the getter's name
-rw-r--r--diff.go7
-rw-r--r--index.go7
-rw-r--r--merge_test.go2
-rw-r--r--settings.go7
-rw-r--r--settings_test.go4
5 files changed, 21 insertions, 6 deletions
diff --git a/diff.go b/diff.go
index 0939435..edc1e20 100644
--- a/diff.go
+++ b/diff.go
@@ -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
}
@@ -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
diff --git a/index.go b/index.go
index 50538bd..150abf2 100644
--- a/index.go
+++ b/index.go
@@ -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
@@ -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)
diff --git a/merge_test.go b/merge_test.go
index 7cf034f..319bef3 100644
--- a/merge_test.go
+++ b/merge_test.go
@@ -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)
}
diff --git a/settings.go b/settings.go
index c6dfe1c..9f2ec02 100644
--- a/settings.go
+++ b/settings.go
@@ -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)
}
diff --git a/settings_test.go b/settings_test.go
index 4e45567..150ee7c 100644
--- a/settings_test.go
+++ b/settings_test.go
@@ -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 {