Skip to content

Certain modifications showing up inconsistently #1000

Closed
@ceball

Description

@ceball
  • I was not able to find an open or closed issue matching what I'm seeing

(I tried - sorry if I failed...)

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.9.2.windows.1
sizeof-long: 4
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.14393]

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt
Path Option: Cmd
SSH Option: OpenSSH
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?
$ cat ~/.gitconfig
...
[core]
        eol = lf
        autocrlf = false
        ...

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

git bash

If I make a small modification to a binary Excel .xls file, that modification is not always showing up in git - seemingly dependent on whether or not I run git status before modifying the file.

Create a repository, mark .xls as binary, add an xls file:

$ mkdir test && cd test

$ git init
Initialized empty Git repository in C:/Users/chris/AppData/Roaming/test/.git/

$ echo '*.xls -text -diff' > .gitattributes

$ git add .gitattributes

$ git commit -m "init"
[master (root-commit) 66a5c6a] init
 1 file changed, 1 insertion(+)
 create mode 100644 .gitattributes

$ sha256sum test.xls
78b56ecec9f3ead3d230dad6df7da5416e661a155962cdf3aa3d064d09e6f710 *test.xls

$ git add test.xls

$ git commit -m "test file"
[master 0e7a594] test file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.xls

(1) Run git status after checkout - modification to file does not show up:

$ rm test.xls

$ git checkout test.xls

$ sha256sum test.xls
78b56ecec9f3ead3d230dad6df7da5416e661a155962cdf3aa3d064d09e6f710 *test.xls

$ git status
On branch master
nothing to commit, working tree clean

# open test.xls in excel and then close it (don't save)

$ sha256sum test.xls
3eba30b2aa34e2325adb86e0c33a8d6a933f5c6bcab7e61e6d1da9cd0fa80fde *test.xls

$ git status
On branch master
nothing to commit, working tree clean

(2) Don't run git status after checkout - modification to file does show up:

$ rm test.xls

$ git checkout test.xls

$ sha256sum test.xls
78b56ecec9f3ead3d230dad6df7da5416e661a155962cdf3aa3d064d09e6f710 *test.xls

# open test.xls in excel and then close it (don't save)

$ sha256sum test.xls
d9836a97d06a39a29b7a4d84ad82f80075f35a64e5a4d85a016ec9e9c20d9b03 *test.xls

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test.xls

no changes added to commit (use "git add" and/or "git commit -a")

  • What did you expect to occur after running these commands?

In both case (1) and case (2), I expected test.xls to show up as modified.

  • What actually happened instead?

Only in case (2) did test.xls show up as modified.

I happen to have docker running on this machine. Doing the same test as above (on the same file) but in a linux container with the repository mounted from the host windows machine, I get the result I expected (i.e. the file shows up as modified in both cases). However, the container does not have the same version of git, nor does it have the same global git configuration as the Windows host.

$ git --version
git version 2.1.4

$ cat ~/.gitconfig
...
[core]
        ...
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Repository can be created using commands above. I've attached test.xls and test2.xls in a zip file - test2.xls is the result of opening test.xls in Excel and then closing it (without explicitly saving).

test.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions