Skip to content

Commit 7593039

Browse files
authored
Split apply logic by fragment type (#32)
Remove the Applier type and replace it with TextApplier and BinaryApplier, both of which operate on fragments instead of on full files. Move the logic that previously existed in Applier.ApplyFile to the top-level Apply function. Also restructure arguments and methods to make it clear that appliers are one-time-use objects. The destination is now set when creating an applier and the Reset() method was replaced by Close().
1 parent 8764d81 commit 7593039

File tree

6 files changed

+398
-404
lines changed

6 files changed

+398
-404
lines changed

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ linters:
1111
- golint
1212
- govet
1313
- ineffassign
14+
- misspell
1415
- typecheck
1516
- unconvert
1617
- varcheck

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if err != nil {
2929

3030
// apply the changes in the patch to a source file
3131
var output bytes.Buffer
32-
if err := gitdiff.NewApplier(code).ApplyFile(&output, files[0]); err != nil {
32+
if err := gitdiff.Apply(&output, code, files[0]); err != nil {
3333
log.Fatal(err)
3434
}
3535
```

0 commit comments

Comments
 (0)