Commit 7f2fa5fa authored by Ximin Luo's avatar Ximin Luo

Add a --exclude-directory-metadata option. (Closes: #866241)

parent 037c9238
diffoscope (84) UNRELEASED; urgency=medium
* Add a --exclude-directory-metadata option. (Closes: #866241)
-- Ximin Luo <infinity0@debian.org> Fri, 30 Jun 2017 18:25:03 +0200
diffoscope (83) unstable; urgency=medium
[ Chris Lamb ]
......
......@@ -24,6 +24,7 @@ import logging
import subprocess
from collections import OrderedDict
from diffoscope.config import Config
from diffoscope.exc import RequiredToolNotFound
from diffoscope.tools import tool_required
from diffoscope.progress import Progress
......@@ -100,6 +101,10 @@ class Getfacl(Command):
def compare_meta(path1, path2):
if Config().exclude_directory_metadata:
logger.debug("Excluding directory metadata for paths (%s, %s)", path1, path2)
return []
logger.debug('compare_meta(%s, %s)', path1, path2)
differences = []
try:
......
......@@ -35,6 +35,7 @@ class Config(object):
enforce_constraints = True
excludes = ()
exclude_commands = ()
exclude_directory_metadata = False
compute_visual_diffs = False
max_container_depth = 50
......
......@@ -169,6 +169,17 @@ def create_parser():
'the longest time, and differences here are probably '
'only secondary differences caused by something that '
'is already represented elsewhere in the diff.')
group3.add_argument('--exclude-directory-metadata', action='store_true',
help='Exclude directory metadata. Useful if comparing '
'files whose filesystem-level metadata is not intended '
'to be distributed to other systems. For example, this '
'is true for most distros\' package builders, but not '
'true for the output of commands like `make install`. '
'Metadata of archive members remain un-excluded.')
group3.add_argument('--no-exclude-directory-metadata', action='store_const',
const=False, dest='exclude_directory_metadata',
help='Don\'t exclude directory metadata, useful to '
'cancel an earlier --exclude-directory-metadata flag.')
group3.add_argument('--fuzzy-threshold', type=int,
help='Threshold for fuzzy-matching '
'(0 to disable, %(default)s is default, 400 is high fuzziness)',
......@@ -299,6 +310,7 @@ def run_diffoscope(parsed_args):
Config().new_file = parsed_args.new_file
Config().excludes = parsed_args.excludes
Config().exclude_commands = parsed_args.exclude_commands
Config().exclude_directory_metadata = parsed_args.exclude_directory_metadata
Config().compute_visual_diffs = PresenterManager().compute_visual_diffs()
set_path()
set_locale()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment