[diffoscope] 04/05: comparators.utils: Don't uselessly run xxd(1) on non-directories.

Chris Lamb chris at chris-lamb.co.uk
Tue Feb 7 04:32:28 CET 2017

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

lamby pushed a commit to branch master
in repository diffoscope.

commit 42c4c3a2d5f8e63c868e4241c3f15de68761513d
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Feb 7 15:40:40 2017 +1300

    comparators.utils: Don't uselessly run xxd(1) on non-directories.
    Signed-off-by: Chris Lamb <lamby at debian.org>
 diffoscope/comparators/utils/file.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/diffoscope/comparators/utils/file.py b/diffoscope/comparators/utils/file.py
index fd9e0e9..3db6346 100644
--- a/diffoscope/comparators/utils/file.py
+++ b/diffoscope/comparators/utils/file.py
@@ -200,6 +200,8 @@ class File(object, metaclass=abc.ABCMeta):
     def has_same_content_as(self, other):
         logger.debug('Binary.has_same_content: %s %s', self, other)
+        if os.path.isdir(self.path) or os.path.isdir(other.path):
+            return False
         # try comparing small files directly first
             my_size = os.path.getsize(self.path)

Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git

More information about the diffoscope mailing list