Merge pull request #582 from suhaibmujahid/method-rename
It is not Go idiomatic to put Get into the getter's name
(cherry picked from commit 31f877e249
)
This commit is contained in:
parent
8334650b1c
commit
d6ab8729d8
7
diff.go
7
diff.go
|
@ -144,7 +144,7 @@ func (diff *Diff) NumDeltas() (int, error) {
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
|
func (diff *Diff) Delta(index int) (DiffDelta, error) {
|
||||||
if diff.ptr == nil {
|
if diff.ptr == nil {
|
||||||
return DiffDelta{}, ErrInvalid
|
return DiffDelta{}, ErrInvalid
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,11 @@ func (diff *Diff) GetDelta(index int) (DiffDelta, error) {
|
||||||
return ret, nil
|
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 {
|
func newDiffFromC(ptr *C.git_diff, repo *Repository) *Diff {
|
||||||
if ptr == nil {
|
if ptr == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
7
index.go
7
index.go
|
@ -528,7 +528,7 @@ type IndexConflict struct {
|
||||||
Their *IndexEntry
|
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 cancestor *C.git_index_entry
|
||||||
var cour *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
|
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 {
|
func (v *Index) RemoveConflict(path string) error {
|
||||||
|
|
||||||
cpath := C.CString(path)
|
cpath := C.CString(path)
|
||||||
|
|
|
@ -109,7 +109,7 @@ func TestMergeTreesWithoutAncestor(t *testing.T) {
|
||||||
if !index.HasConflicts() {
|
if !index.HasConflicts() {
|
||||||
t.Fatal("expected conflicts in the index")
|
t.Fatal("expected conflicts in the index")
|
||||||
}
|
}
|
||||||
_, err = index.GetConflict("README")
|
_, err = index.Conflict("README")
|
||||||
checkFatal(t, err)
|
checkFatal(t, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
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 {
|
func SetCacheMaxSize(maxSize int) error {
|
||||||
return setSizet(C.GIT_OPT_SET_CACHE_MAX_SIZE, maxSize)
|
return setSizet(C.GIT_OPT_SET_CACHE_MAX_SIZE, maxSize)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ func TestEnableCaching(t *testing.T) {
|
||||||
checkFatal(t, err)
|
checkFatal(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetCachedMemory(t *testing.T) {
|
func TestCachedMemory(t *testing.T) {
|
||||||
current, allowed, err := GetCachedMemory()
|
current, allowed, err := CachedMemory()
|
||||||
checkFatal(t, err)
|
checkFatal(t, err)
|
||||||
|
|
||||||
if current < 0 {
|
if current < 0 {
|
||||||
|
|
Loading…
Reference in New Issue