[Git][reproducible-builds/diffoscope][master] 2 commits: Inline call/check of Config().force_details; no need for an additional variable.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Wed Jan 22 11:55:27 UTC 2025



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
d4fb5f17 by Chris Lamb at 2025-01-22T11:52:54+00:00
Inline call/check of Config().force_details; no need for an additional variable.

- - - - -
5b187ad5 by Chris Lamb at 2025-01-22T11:55:03+00:00
When passing files on the command line, don't call specialize(..) before we've checked that the files are identical. (Closes: reproducible-builds/diffoscope#400)

- - - - -


1 changed file:

- diffoscope/comparators/utils/compare.py


Changes:

=====================================
diffoscope/comparators/utils/compare.py
=====================================
@@ -63,9 +63,14 @@ def compare_root_paths(path1, path2):
         return compare_directories(path1, path2)
 
     container1 = FilesystemDirectory(os.path.dirname(path1)).as_container
-    file1 = specialize(FilesystemFile(path1, container=container1))
+    file1 = FilesystemFile(path1, container=container1)
     container2 = FilesystemDirectory(os.path.dirname(path2)).as_container
-    file2 = specialize(FilesystemFile(path2, container=container2))
+    file2 = FilesystemFile(path2, container=container2)
+
+    with profile("has_same_content_as", file1):
+        if file1.has_same_content_as(file2):
+            return None
+
     difference = compare_files(file1, file2)
 
     if Config().exclude_directory_metadata in ("no", "recursive"):
@@ -110,12 +115,11 @@ def compare_files(file1, file2, source=None, diff_content_only=False):
         specialize(file1)
         specialize(file2)
 
-    force_details = Config().force_details
     with profile("has_same_content_as", file1):
         has_same_content = file1.has_same_content_as(file2)
 
     if has_same_content:
-        if not force_details:
+        if not Config().force_details:
             logger.debug(
                 "has_same_content_as returned True; skipping further comparisons"
             )



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/e2c211724f8d3865e20aed025a18b5a1ae7b95ce...5b187ad563526412fb5a5b328464f13047a49eff

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/e2c211724f8d3865e20aed025a18b5a1ae7b95ce...5b187ad563526412fb5a5b328464f13047a49eff
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20250122/2a872755/attachment.htm>


More information about the rb-commits mailing list