Skip to content

Commit

Permalink
git-diff-x default args
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Nov 15, 2024
1 parent 2e354da commit 2097394
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions qmdx/git_diff_x/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def main(
else:
raise ValueError(f"Invalid refspec: {refspec}")

diff_args = [
*(['-w'] if ignore_whitespace else []),
*(['-U', str(unified)] if unified is not None else []),
*(['--color=always'] if color else []),
]
if cmds:
cmds1 = [ f'git show {ref1}:{path}', *cmds ]
if ref2:
Expand All @@ -69,17 +74,12 @@ def main(
cmds2 = [ shlex.split(c) for c in cmds2 ]

join_pipelines(
base_cmd=[
'diff',
*(['-w'] if ignore_whitespace else []),
*(['-U', str(unified)] if unified is not None else []),
*(['--color=always'] if color else []),
],
base_cmd=['diff', *diff_args],
cmds1=cmds1,
cmds2=cmds2,
verbose=verbose,
shell=not no_shell,
shell_executable=shell_executable,
)
else:
process.run(['git', 'diff', refspec, '--', path])
process.run(['git', 'diff', *diff_args, refspec, '--', path])

0 comments on commit 2097394

Please sign in to comment.