Re: "git diff" does not show a diff for newly added, binary files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 04, 2023 at 11:58:38AM +0200, Thorsten Otto wrote:

> "git diff" does not show a diff for newly added, binary files
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
> $ git init .
> $ touch a
> $ git add a
> $ git commit -m "first commit"
> $ dd if=/dev/zero of=b count=1
> $ git add b
> $ echo hello > c
> $ git add c
> $ git diff --cached
> 
> What did you expect to happen? (Expected behavior)
> 
> I expected a binary diff for the new file, just like it is done
> when comparing two different, already committed revisions.

I responded elsewhere in the thread mentioning "git diff --binary", but
note this part of the report is a little misleading. The difference is
not showing newly added files versus committed revisions. The difference
is between "git diff" and "git format-patch". If you commit the result
above and then run:

  git diff HEAD^ HEAD

it will likewise not show the binary patch (unless you specify
--binary). Likewise for "git show", etc. I think that format-patch is
the only command with binary diffs turned on by default.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux