Skip to content
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

Add patch.LineStats func to get patch additions/deletions summary #949

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Rename patch.Stats to LineStats
sosedoff committed Mar 15, 2023
commit e24dc55e1ba8119f70170c6f55c89e1199120501
2 changes: 1 addition & 1 deletion patch.go
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ func (patch *Patch) Free() error {
return nil
}

func (patch *Patch) Stats() (uint, uint, error) {
func (patch *Patch) LineStats() (uint, uint, error) {
if patch.ptr == nil {
return 0, 0, ErrInvalid
}
6 changes: 3 additions & 3 deletions patch_test.go
Original file line number Diff line number Diff line change
@@ -36,12 +36,12 @@ func TestPatch(t *testing.T) {
t.Fatalf("patch was bad")
}

numAdditions, numDeletions, err := patch.Stats()
numAdditions, numDeletions, err := patch.LineStats()
checkFatal(t, err)
if numAdditions != 1 {
t.Fatal("Incorrect number of additions in stats")
t.Fatal("Incorrect number of additions in line stats")
}
if numDeletions != 1 {
t.Fatal("Incorrect number of deletions in stats")
t.Fatal("Incorrect number of deletions in line stats")
}
}