# diff --stat when chmoding binary files

1 messages from 2011-08-15 to 2011-08-15. Participants: Martin Mares.
Thread: https://gitlist.dev/t/28103

## Martin Mares, 2011-08-15 08:50

Subject: diff --stat when chmoding binary files
Message-ID: <mj+md-20110815.084527.10358.albireo@ucw.cz>
URL: https://gitlist.dev/e/mj%2Bmd-20110815.084527.10358.albireo%40ucw.cz

```
Hello, world!\n

I have discovered somewhat surprising behavior of `git diff --stat'
on files, which are not modified except for their executable bits.
When the file is binary, it is listed in the diffstat, otherwise
it is not.

For example:

| mj@albireo:/tmp$ mkdir gt
| mj@albireo:/tmp$ cd gt
| mj@albireo:/tmp/gt$ git init
| Initialized empty Git repository in /tmp/gt/.git/
| mj@albireo:/tmp/gt$ echo abcdef >a
| mj@albireo:/tmp/gt$ dd if=/dev/zero of=b bs=1024 count=1
| 1+0 records in
| 1+0 records out
| 1024 bytes (1.0 kB) copied, 7.3243e-05 s, 14.0 MB/s
| mj@albireo:/tmp/gt$ git add *
| mj@albireo:/tmp/gt$ git commit -m 'adding'
| [master (root-commit) 295d5f9] adding
|  2 files changed, 1 insertions(+), 0 deletions(-)
|  create mode 100644 a
|  create mode 100644 b
| mj@albireo:/tmp/gt$ chmod 755 *
| mj@albireo:/tmp/gt$ git add *
| mj@albireo:/tmp/gt$ git commit -m 'chmoding'
| [master 61c251b] chmoding
|  1 files changed, 0 insertions(+), 0 deletions(-)
|  mode change 100644 => 100755 a
|  mode change 100644 => 100755 b
| mj@albireo:/tmp/gt$ git diff HEAD^
| diff --git a/a b/a
| old mode 100644
| new mode 100755
| diff --git a/b b/b
| old mode 100644
| new mode 100755
| mj@albireo:/tmp/gt$ git diff --stat HEAD^
|  b |  Bin 1024 -> 1024 bytes
|  1 files changed, 0 insertions(+), 0 deletions(-)

This happens in git-1.7.6 and in several older versions as well.

Am I missing something or is it a bug?

				Have a nice fortnight
-- 
Martin `MJ' Mares                          <mj@ucw.cz>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
Q: Who invented the first airplane that did not fly?  A: The Wrong Brothers.

```
