Skip to content

Incorrect CHANGE? #114

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

Closed
cosmoter opened this issue Jan 12, 2021 · 4 comments
Closed

Incorrect CHANGE? #114

cosmoter opened this issue Jan 12, 2021 · 4 comments

Comments

@cosmoter
Copy link

Let's assume we had a file with such a content:
"
A
B
C
D
E
"
We changed the file to:
"
a
C

E
"

Patch =
ChangeDelta, position=0, lines = [A, B] to [a]
UnchangedDelta, position=2, lines = [C] to [C]
ChangeDelta, position=3, lines = [D] to []
UnchangedDelta, position=4, lines = [E] to [E]

DiffRows =
CHANGE, "A" -> "a"
CHANGE, "B" -> ""
CHANGE, "C" -> "C"
CHANGE, "D" -> ""
CHANGE, "E" -> "E"

So DiffRows mixed two absolutely different situations:
CHANGE, "B" -> "" - that was a part of change but has no correspondence in the new file (maybe only "no line")
CHANGE, "D" -> "" - that was actually changed to the empty line

And we cannot distinguish what line in the new file is for E now.
3, 4, or 5?

I offer to set not CHANGE but DELETE for the situation "B" -> "" (or insert vice versa).
Yes it was a part of the change section but in terms of lines it is a deletion. There was a line and there is no line now.
The expected result is:
CHANGE, "A" -> "a"
DELETE, "B" -> ""
CHANGE, "C" -> "C"
CHANGE, "D" -> ""
CHANGE, "E" -> "E"

Another possible solution is to use null for "B" -> "" that can help distinguish two options. But we need to work with null after that.
CHANGE, "A" -> "a"
CHANGE, "B" -> null
CHANGE, "C" -> "C"
CHANGE, "D" -> ""
CHANGE, "E" -> "E"

The error exists in the last version.

@wumpz
Copy link
Collaborator

wumpz commented Jan 14, 2021

Isn't #113 a duplicate?

@cosmoter
Copy link
Author

yes, I closed that.

@wumpz
Copy link
Collaborator

wumpz commented Jan 16, 2021

So I am on it. I am implementing now a solution that delivers:

[CHANGE,A,a]
[DELETE,B,]
[EQUAL,C,C]
[CHANGE,D,]
[EQUAL,E,E]

I assume I am following your first suggestion.

@wumpz wumpz closed this as completed in 7e8d286 Jan 16, 2021
wumpz added a commit that referenced this issue Jan 16, 2021
@wumpz
Copy link
Collaborator

wumpz commented Jan 16, 2021

Could you check it? I deployed a new snapshot.

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

No branches or pull requests

2 participants