From: Michael Brown <michael.brown@discourse.org>
To: git@vger.kernel.org
Subject: "git diff-files" command reports differences that don't exist
Date: Fri, 5 Mar 2021 14:28:20 -0500 [thread overview]
Message-ID: <4210f5f1-dd7e-f425-6ab2-e220a33e82bf@discourse.org> (raw)
What did you do before the bug happened? (Steps to reproduce your issue)
1. Be in any existing repository in a clean state (I tested with 2 existing
repositories and 1 completely fresh)
1. run `git diff-files`, see no output
1. touch an existing file: `touch a`
1. run `git diff-files`
What did you expect to happen? (Expected behavior)
`git diff-files` should show no output
What happened instead? (Actual behavior)
`git diff-files` reported a difference on the touched file.
What's different between what you expected and what actually happened?
git reports a difference where none exists
Anything else you want to add:
This difference vanished after running other commands (e.g. `git diff`).
A complete reproduction using docker is below:
$ docker run -it --rm debian:latest
root@d24ec0793bdf:/# apt update && apt -y install git
…
root@d24ec0793bdf:/# mkdir ~/new-repo
root@d24ec0793bdf:/# cd ~/new-repo
root@d24ec0793bdf:~/new-repo# git init
Initialized empty Git repository in /root/new-repo/.git/
root@d24ec0793bdf:~/new-repo# touch a
root@d24ec0793bdf:~/new-repo# git add a
root@d24ec0793bdf:~/new-repo# git config --global user.email
'user@example.net'
root@d24ec0793bdf:~/new-repo# git config --global user.name 'Example User'
root@d24ec0793bdf:~/new-repo# git commit -m 'initial'
[master (root-commit) 791011f] initial
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
root@d24ec0793bdf:~/new-repo# git diff-files
root@d24ec0793bdf:~/new-repo# touch a
root@d24ec0793bdf:~/new-repo# git diff-files
:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
0000000000000000000000000000000000000000 M a
root@d24ec0793bdf:~/new-repo# git diff
root@d24ec0793bdf:~/new-repo# git diff-files
root@d24ec0793bdf:~/new-repo# git --version
git version 2.20.1
[System Info]
git version:
git version 2.30.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.11.1-arch1-1 #1 SMP PREEMPT Tue, 23 Feb 2021 14:05:30
+0000 x86_64
compiler info: gnuc: 10.2
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/bash
This same behaviour was also found in:
* 2.20.1
* 2.25.1
[Enabled Hooks]
(none)
--
Michael Brown
Civilized Discourse Construction Kit, Inc.
https://www.discourse.org/
next reply other threads:[~2021-03-05 19:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 19:28 Michael Brown [this message]
2021-03-05 21:49 ` "git diff-files" command reports differences that don't exist Junio C Hamano
2021-03-05 22:18 ` Eric Sunshine
2021-03-05 22:28 ` Junio C Hamano
2021-03-05 22:20 ` Michael Brown
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4210f5f1-dd7e-f425-6ab2-e220a33e82bf@discourse.org \
--to=michael.brown@discourse.org \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).