Bug#880109: diffoscope: Pony wanted: git mode
Axel Beckert
abe at debian.org
Sun Oct 29 15:34:34 UTC 2017
Package: diffoscope
Version: 87
Severity: wishlist
Hi,
after the discussion around strip-nd's png backend, I tried
"strip-nondeterminism -t png t/fixtures/png/tEXt.png.in" in a checkout
of strip-nd's git repository.
Now the file t/fixtures/png/tEXt.png.in is locally modified:
→ git status --short
M t/fixtures/png/tEXt.png.in
I would like to be able to use diffoscope to show the difference between
the checked in version and the local (or staged) version of a binary
file.
So I tried
→ git diff --binary | diffoscope
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 412, in main
sys.exit(run_diffoscope(parsed_args))
File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 377, in run_diffoscope
difference = load_diff(sys.stdin, "stdin")
File "/usr/lib/python3/dist-packages/diffoscope/readers/__init__.py", line 31, in load_diff
return JSONReaderV1().load(fp, path)
File "/usr/lib/python3/dist-packages/diffoscope/readers/json.py", line 32, in load
raw = json.load(fp)
File "/usr/lib/python3.6/json/__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
but it bails out as shown above.
I can imagine three ways of calling diffoscope to provide such a
feature:
1) Maybe least effort, at least for diffoscope's CLI:
Make "git diff --binary | diffoscope" work, i.e. make it understand
git binary patches, at least while being inside the according git
repository (not sure if that's necessary).
2) Maybe even easier to implement (doesn't need to understand git binary
patches) and would contain a nice CLI:
diffoscope --git [file […]]
diffoscope --git --cached [file […]] (for staged changes)
3) Really super cool solution:
Provide a git diff plugin which outputs diffoscope output instead of
"Binary files a/t/fixtures/png/tEXt.png.in and
b/t/fixtures/png/tEXt.png.in differ". :-)
(That's the Pony I would like to have. :-)
-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (990, 'unstable'), (980, 'unstable-debug'), (600, 'testing'), (111, 'buildd-unstable'), (111, 'buildd-experimental'), (110, 'experimental'), (105, 'experimental-debug')
Architecture: amd64 (x86_64)
Kernel: Linux 4.13.0-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages diffoscope depends on:
ii python3 3.6.3-2
ii python3-distro 1.0.1-2
ii python3-libarchive-c 2.1-3.1
ii python3-magic 1:5.32-1
ii python3-pkg-resources 36.2.7-2
Versions of packages diffoscope recommends:
ii acl 2.2.52-3+b1
pn apktool <none>
ii binutils-multiarch 2.29.1-6
ii bzip2 1.0.6-8.1
ii caca-utils 0.99.beta19-2+b2
ii colord 1:17
ii default-jdk [java-sdk] 2:1.8-59
ii default-jdk-headless 2:1.8-59
pn device-tree-compiler <none>
pn docx2txt <none>
pn enjarify <none>
pn fontforge-extras <none>
pn fp-utils <none>
ii genisoimage 9:1.1.11-3+b2
ii gettext 0.19.8.1-4
ii ghc 8.0.2-10
ii ghostscript 9.22~dfsg-1
pn giflib-tools <none>
ii gnupg 2.2.1-5
ii imagemagick 8:6.9.7.4+dfsg-16
ii imagemagick-6.q16 [imagemagick] 8:6.9.7.4+dfsg-16
ii jsbeautifier 1.6.4-6
ii libarchive-tools 3.2.2-3.1
pn llvm <none>
pn mono-utils <none>
pn odt2txt <none>
pn oggvideotools <none>
ii openjdk-8-jdk [java-sdk] 8u144-b01-2
ii openssh-client 1:7.6p1-2
ii pdftk 2.02-4+b2
ii pgpdump 0.31-0.2
ii poppler-utils 0.57.0-2
pn python3-argcomplete <none>
pn python3-binwalk <none>
ii python3-debian 0.1.31
ii python3-defusedxml 0.5.0-1
pn python3-guestfs <none>
pn python3-progressbar <none>
ii python3-rpm 4.12.0.2+dfsg1-2+b1
ii python3-tlsh 3.4.4+20151206-1+b3
pn r-base-core <none>
ii rpm2cpio 4.12.0.2+dfsg1-2+b1
pn sng <none>
ii sqlite3 3.20.1-2
ii squashfs-tools 1:4.3-4
ii tcpdump 4.9.2-1
ii unzip 6.0-21
ii vim-common 2:8.0.1226-1
ii xxd 2:8.0.1226-1
ii xz-utils 5.2.2-1.3
Versions of packages diffoscope suggests:
ii libjs-jquery 3.2.1-1
-- no debconf information
More information about the Reproducible-builds
mailing list