All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Otto <admin@tho-otto.de>
To: git@vger.kernel.org
Subject: "git diff" does not show a diff for newly added, binary files
Date: Tue, 04 Apr 2023 11:58:38 +0200	[thread overview]
Message-ID: <3473764.PTxrJRyG3s@earendil> (raw)

"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.

What happened instead? (Actual behavior)

The "git diff" command only showed a diff for the text file c, 
but not for the binary file b:

diff --git a/b b/b
new file mode 100644
index 0000000..a64a5a9
Binary files /dev/null and b/b differ
diff --git a/c b/c
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/c
@@ -0,0 +1 @@
+hello

[System Info]
git version:
git version 2.39.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.1.3-1-default #1 SMP PREEMPT_DYNAMIC Wed Jan  4 11:03:53 UTC 
2023 (a5315fb) x86_64
compiler info: gnuc: 12.2
libc info: glibc: 2.36
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]




             reply	other threads:[~2023-04-04 10:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  9:58 Thorsten Otto [this message]
2023-04-04 10:17 ` "git diff" does not show a diff for newly added, binary files Kristoffer Haugsbakk
2023-04-04 10:39   ` Thorsten Otto
2023-04-04 10:45     ` Kristoffer Haugsbakk
2023-04-04 11:23       ` Thorsten Otto
2023-04-04 11:29         ` Kristoffer Haugsbakk
2023-04-04 15:36     ` Jeff King
2023-04-04 15:42   ` Junio C Hamano
2023-04-04 15:37 ` Junio C Hamano
2023-04-04 15:39 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3473764.PTxrJRyG3s@earendil \
    --to=admin@tho-otto.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.