Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

packfile: delta diff implementation #159

Merged
merged 2 commits into from
Dec 9, 2016
Merged

packfile: delta diff implementation #159

merged 2 commits into from
Dec 9, 2016

Conversation

ajnavarro
Copy link
Contributor

  • 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
@codecov-io
Copy link

codecov-io commented Dec 5, 2016

Current coverage is 76.99% (diff: 75.00%)

Merging #159 into master will decrease coverage by 0.71%

@@             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   

Powered by Codecov. Last update 3df9063...258f5e2


*/

// Code obtained from https://github.com/pmezard/go-difflib
Copy link
Collaborator

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?

Copy link
Collaborator

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"

Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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) {
Copy link
Contributor

@alcortesm alcortesm Dec 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should receive io.Readers, not plubing.Objects and write in a writer.

Copy link
Contributor

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

@ajnavarro ajnavarro Dec 9, 2016

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 {

@smola smola dismissed alcortesm’s stale review December 9, 2016 16:36

requested changes already done or explained

@mcuadros mcuadros merged commit f0106fa into src-d:master Dec 9, 2016
mcuadros pushed a commit that referenced this pull request Jan 31, 2017
* 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
gsalingu-ovhus pushed a commit to gsalingu-ovhus/go-git that referenced this pull request Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants