[diffoscope] 02/09: Drop libarchive check; prevent directories from being byte-compared instead.
Maria Glukhova
siamezzze-guest at moszumanska.debian.org
Mon Feb 13 20:39:59 CET 2017
This is an automated email from the git hooks/post-receive script.
siamezzze-guest pushed a commit to branch siamezzze/containers
in repository diffoscope.
commit ed0bbc53e15f211c1d96bce8394d4505720f180a
Author: Maria Glukhova <siamezzze at gmail.com>
Date: Fri Jan 20 08:07:42 2017 +0200
Drop libarchive check; prevent directories from being byte-compared instead.
In case of cross-container comparison, it might happen that Directory
subclass objects (ZipDirectory, SquashfsDirectory, ...) will be compared
using compare_files. We don't want this comparison to be handled by compare_bytes.
---
diffoscope/comparators/utils/compare.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/diffoscope/comparators/utils/compare.py b/diffoscope/comparators/utils/compare.py
index 552ec57..4293fdd 100644
--- a/diffoscope/comparators/utils/compare.py
+++ b/diffoscope/comparators/utils/compare.py
@@ -86,14 +86,9 @@ def compare_containers(file1, file2, source=None):
source="file list"
)])
- if isinstance(container1, LibarchiveContainer) == \
- isinstance(container2, LibarchiveContainer):
- logger.debug("Comparing content.")
- details.extend(container1.compare(container2))
- else:
- logger.debug("Can't compare libarchive with regular container, "
- "falling back to binary diff.")
- details.extend([file1.compare_bytes(file2, source)])
+ logger.debug("Comparing content.")
+ details.extend(container1.compare(container2, source))
+
details = [d for d in details if d is not None]
difference.add_details(details)
return difference
@@ -123,6 +118,9 @@ def compare_files(file1, file2, source=None):
elif file1.__class__.__name__ != file2.__class__.__name__:
if file1.as_container and file2.as_container:
return compare_containers(file1, file2, source)
+ if file1.is_directory() and file2.is_directory():
+ # ZipDirectory, LibarchiveDirectory etc.
+ return None
return file1.compare_bytes(file2, source)
with profile('compare_files (cumulative)', file1):
return file1.compare(file2, source)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list