Closed egibs closed 3 days ago
Diffing archives is exhibiting inconsistent behavior so I need to fix that.
Edit: updated in 6180a11
(#628). Without this change, the files in each report were being compared as if they were single files rather than an extracted directory of files. With concurrent processing, each diff would show a [single] different file.
This is huge - thank you!
Will merge in a bit. Working on one last bug.
With the clarification about diff(1) behavior in #599, I wanted to get something written up to address the current implementation gap.
This PR overhauls diff and tries to mimic what
diff(1)
does --When diffing directories, the source file report is first compared to the destination report to identify matching files, followed by files only present in the source path. Afterward, the opposite is done to identify files that exist only in the destination path.
The
processSrc
,processDest
, andfileDestination
functions were confusing and I thinkhandleFile
does everything we need for "modified" files. Otherwise, we're just directly adding reports to the Added/Removed map.I also started tracking consistent behaviors across modified files (originally called existing I think?) and I also updated the renderers to account for the new behaviors. Depending on the format, consistent behaviors will show with no
+
or-
. In the terminal, consistent behaviors will show up as cyan; the updated diff test data also contains these behaviors.Examples:
Two directories:
Two relative directories:
Two unrelated files:
Two unrelated files in the same parent:
Moving further down the directory structure:
Two directories that share a file of the same name:
Consistent archive diffs: