lib/diff: ignore xattrs if disabled on either repos
authorLuca BRUNO <luca.bruno@coreos.com>
Mon, 23 Aug 2021 12:39:02 +0000 (12:39 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Mon, 23 Aug 2021 13:31:13 +0000 (13:31 +0000)
This fixes the logic to detect whether xattrs should be automatically
ignored when diffing.

src/libostree/ostree-diff.c

index da018db4115bd877136b074db92105f55787b5ef..e2d68d0ad887f67b23077eae76febd113b3158cb 100644 (file)
@@ -268,15 +268,18 @@ ostree_diff_dirs_with_options (OstreeDiffFlags        flags,
   /* If we're diffing versus a repo, and either of them have xattrs disabled,
    * then disable for both.
    */
-  OstreeRepo *repo;
   if (OSTREE_IS_REPO_FILE (a))
-    repo = ostree_repo_file_get_repo ((OstreeRepoFile*)a);
-  else if (OSTREE_IS_REPO_FILE (b))
-    repo = ostree_repo_file_get_repo ((OstreeRepoFile*)b);
-  else
-    repo = NULL;
-  if (repo != NULL && repo->disable_xattrs)
-    flags |= OSTREE_DIFF_FLAGS_IGNORE_XATTRS;
+    {
+      OstreeRepo *repo = ostree_repo_file_get_repo ((OstreeRepoFile*)a);
+      if (repo->disable_xattrs)
+        flags |= OSTREE_DIFF_FLAGS_IGNORE_XATTRS;
+    }
+  if (OSTREE_IS_REPO_FILE (b))
+    {
+      OstreeRepo *repo = ostree_repo_file_get_repo ((OstreeRepoFile*)b);
+      if (repo->disable_xattrs)
+        flags |= OSTREE_DIFF_FLAGS_IGNORE_XATTRS;
+    }
 
   if (a == NULL)
     {