[Bug 5510] New: git diff mode ignores the -a (--text) flag, dumping out binaries instead

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Mar 20 13:57:18 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5510

            Bug ID: 5510
           Summary: git diff mode ignores the -a (--text) flag, dumping
                    out binaries instead
           Product: Mercurial
           Version: default branch
          Hardware: Macintosh
                OS: Mac OS
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: simonfar at fb.com
                CC: mercurial-devel at mercurial-scm.org

When you ask `hg diff` to show you a diff including a binary file, you get a
"binary file changed" notice instead of a huge diff:

  $ hg init
  $ cp /bin/ls binary
  $ hg commit -Am init
  adding binary
  $ cp /bin/cp binary
  $ hg diff
  diff -r ab9f5960e788 binary
  Binary file binary has changed

If you use the --text or -a flag, you get a full diff:
  $ hg diff -a
  diff -r ab9f5960e788 binary
  --- a/binary    Mon Mar 20 13:52:33 2017 +0000
  +++ b/binary    Mon Mar 20 13:54:10 2017 +0000
  @@ -1,52 +1,27 @@
<snip binary junk>

However, if you use the --git flag, you get a git binary diff:
  $ hg diff --git | head -n4
  diff --git a/binary b/binary
  index 
 
1bf8f59e5d36939c9c89403c68707f4943ef2183..d432d4d9f4462bbd1038bf9649a2b871578e2d48
  GIT binary patch
  literal 28912

I would expect you to need the -a flag, like git does:

  $ git diff
  index 1bf8f59..d533a9d 100755
  Binary files a/binary and b/binary differ
  $ git diff -a
  diff --git a/binary b/binary
  index d533a9d..ece1e42 100755
  --- a/binary
  +++ b/binary
  @@ -1,4024 +1,223 @@
<snip binary junk>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list