Re:Unified versus Split Diff
by videlov on Tuesday October 24, 2023 @05:19AM
(#37996597)
Thank you for sharing this project! I have been searching for something like this for some time
[ Parent
| on HN ]
I also wonder if it's possible to go beyond this project and have git itself work on the syntax level instead of pure text.
Git doesn't store diffs on logical level. Git operates on snapshots of trees. Commit is not "a collection of changes", it's a snapshot of a tree with attached predecessor of it.
Then the another layer (which can be git, but also can be any other tool, adding custom diff tool to git is very easy) uses that to generate diffs.
There is zero stopping anyone from adding contextual diffs to Git. Just ask it for content of both commits and feed it to the algorithm.
Yes, git underneath stores data as diffs but they are only vaguely related to logical structure of commits
Interesting. Wonder if something like that can be used to make git cleverer about merges for example.
Git’s merge algorithm looks at three versions of the code: the two branch tips being merged, and their common ancestor. It might be better at resolving conflicts if it looked at some of the intermediate commits as well, but I don’t know of anything that does so.
Merge part isn't pluggable like that IIRC. Would be interesting if that was given stable interface, then supposed "smart merge" tool could iterate with few ways to merge code while running tests to check which one produces least/no errors
Re:Unified versus Split Diff
by yencabulator on Tuesday October 24, 2023 @06:29PM
(#38006565)
> Yes, git underneath stores data as diffs but they are only vaguely related to logical structure of commits
And that's why we call that lower level compression trick "delta", not "diff".
> Then the another layer (which can be git, but also can be any other tool, adding custom diff tool to git is very easy) uses that to generate diffs.
Linky: https://stackoverflow.com/questions/255202/how-do-i-view-git...
Re:Unified versus Split Diff
by mechanicker on Tuesday October 24, 2023 @10:08AM
(#37999371)
I feel it is best to leave git out of this - separation of concerns
Let external tools evolve independently instead.