[diffoscope] 01/02: comparators: utils: compare: fixes comparison between container types

Juliana Oliveira R jwnx-guest at moszumanska.debian.org
Sun Sep 10 06:29:29 CEST 2017


This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_fix_different_container_type_comparison
in repository diffoscope.

commit 0cc8ab6d02ad7e37f6d89ba9f4d4abc74ebb38ac
Author: Juliana Oliveira Rodrigues <juliana.orod at gmail.com>
Date:   Sun Sep 10 00:36:52 2017 -0300

    comparators: utils: compare: fixes comparison between container types
    
    This patch solves comparison between different container types not
    comparing inside files. It was caused by falling back to binary
    comparison for different file types even for unextracted containers.
    
    Adding a container check before falling back to binary comparison
    ensures container extraction before file comparison, fixing the
    problem.
---
 diffoscope/comparators/utils/compare.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/diffoscope/comparators/utils/compare.py b/diffoscope/comparators/utils/compare.py
index a22007c..25b92e9 100644
--- a/diffoscope/comparators/utils/compare.py
+++ b/diffoscope/comparators/utils/compare.py
@@ -91,7 +91,8 @@ def compare_files(file1, file2, source=None, diff_content_only=False):
         file1.other_file = file2
     elif isinstance(file2, MissingFile):
         file2.other_file = file1
-    elif file1.__class__.__name__ != file2.__class__.__name__:
+    elif ((file1.__class__.__name__ != file2.__class__.__name__) and
+          (file1.as_container is None or file2.as_container is 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