-
Notifications
You must be signed in to change notification settings - Fork 534
Conversation
ajnavarro
commented
Dec 5, 2016
- Renamed delta.go to patch_delta.go
- Added diff_delta.go file
- Added tests that creates a diff and then tries to patch it
- Renamed delta.go to patch_delta.go - Added diff_delta.go file - Added tests that creates a diff and then tries to patch it
Current coverage is 76.99% (diff: 75.00%)@@ master #159 diff @@
==========================================
Files 88 90 +2
Lines 5475 5691 +216
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 4255 4382 +127
- Misses 761 844 +83
- Partials 459 465 +6
|
|
||
*/ | ||
|
||
// Code obtained from https://github.com/pmezard/go-difflib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we import pmezard/go-difflib and use it directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Code obtained from" -> "Code based on"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain changes.
opCodes []OpCode | ||
} | ||
|
||
func NewMatcher(a, b []byte) *sequenceMatcher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
|
||
// Code obtained from https://github.com/pmezard/go-difflib | ||
|
||
type Match struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
Size int | ||
} | ||
|
||
type OpCode struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
) | ||
|
||
// GetDelta returns the way of how to transform base object to target object | ||
func GetDelta(base, target plumbing.Object) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should receive io.Reader
s, not plubing.Object
s and write in a writer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we are following the correct approach here, by including modified files from other projects, let's discuss this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please, use io.Reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. GetDelta takes plumbing.Object in order to be symmetric with ApplyDelta. Let's keep it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is to have the same logic that is used into patch_delta.go:
func ApplyDelta(target, base plumbing.Object, delta []byte) error {
requested changes already done or explained
* packfile: delta diff implementation - Renamed delta.go to patch_delta.go - Added diff_delta.go file - Added tests that creates a diff and then tries to patch it * Requested changes
Bump version