Skip to content

Combine modified and renamed behaviour to allow for modified + renamed - #9

Merged
alex-e-leon merged 2 commits into
alex-e-leon:masterfrom
stuartherring:master
Mar 6, 2019
Merged

alex-e-leon merged 2 commits into
alex-e-leon:masterfrom
stuartherring:master

Conversation

@stuartherring

Copy link
Copy Markdown
Contributor

If a file was both modified and renamed between the two versions, then
it was treated as just a rename.
Whilst the patch contents would still be correct, only the contents of
fileB would be downloaded (presumably as an optimisation, since in a
pure rename the contents would be identical), and were used for both
fileA and fileB.

This would mean that when comparing fileA and fileB in the case of a
rename + modify, that the modification would be lost.

This unifies the logic for modify and rename, but handles the differing
filenames in the rename case.
It has the cost of an extra getContent request for pure renames.

If a file was both modified and renamed between the two versions, then 
it was treated as just a rename.
Whilst the patch contents would still be correct, only the contents of 
fileB would be downloaded (presumably as an optimisation, since in a 
pure rename the contents would be identical), and were used for both 
fileA and fileB.

This would mean that when comparing fileA and fileB in the case of a 
rename + modify, that the modification would be lost.

This unifies the logic for modify and rename, but handles the differing 
filenames in the rename case.
It has the cost of an extra getContent request for pure renames.
@alex-e-leon

Copy link
Copy Markdown
Owner

@stuartherring good points - and thanks for the PR! Correct code is generally better than performant code, so I'm also ok with the extra getContent request in this case.

One thing though - in the documented API it only returns a previousFilename if the filename has been renamed - but in this case it's returning it for every modified file - in order to avoid a breaking change, would you be able to adjust the logic so that the API remains the same?

@stuartherring

Copy link
Copy Markdown
Contributor Author

No worries, PR updated

@alex-e-leon
alex-e-leon merged commit 8efd163 into alex-e-leon:master Mar 6, 2019
@alex-e-leon

Copy link
Copy Markdown
Owner

Thanks for the contribution @stuartherring - published in v1.3.3

@stuartherring

Copy link
Copy Markdown
Contributor Author

No worries, thanks for looking at it so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants