-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Certain modifications showing up inconsistently #1000
Comments
Sorry for the long silence, this ticket simply fell under my radar. I just tried this, and can confirm. Upon closer inspection using I fear that the described problem is related to the fact that Git for Windows has to take a couple of shortcuts when trying to emulate Linux' semantics. In particular, when the so-called "stat" data (essentially, all the metadata for a give file) is emulated, we use the But we do not have a fast way to get at the change time, only the access time, modified time and creation time. We could get the change time, via the So what Git for Windows does is rely on applications to update the modified time when changing any file contents. But that is not the case with Excel. I fear there is not really anything we can do here, not unless we want to slow down Git for Windows dramatically (in most cases, for no good reason)... |
----- Original Message -----
Sorry for the long silence, this ticket simply fell under my radar.
I just tried this, and can confirm. Upon closer inspection using stat test.xls in Git Bash, it would appear that the change time is modifed by Excel along with the bytes on disk, but not the modified time.
I fear that the described problem is related to the fact that Git for Windows has to take a couple of shortcuts when trying to emulate Linux' semantics. In particular, when the so-called "stat" data (essentially, all the metadata for a give file) is emulated, we use the FindFirstFile()/FindNextFile() API which gives us the time of the last access, the time of the last modification and the creation time. Sadly, that differs slightly from the POSIX semantics that Git wants to see, where the first two times are identical, but the ctime does not refer to the creation time but the change time.
But we do not have a fast way to get at the change time, only the access time, modified time and creation time. We could get the change time, via the ChangeTime field in the FILE_BASIC_INFO data structure initialized by GetFileAttributesByHandleEx() function, but that requires a HANDLE, which we can only obtain using CreateFile() (which is orders of magnitude slower than FindFirstFile()/FindNextFile().
So what Git for Windows does is rely on applications to update the modified time when changing any file contents. But that is not the case with Excel.
I fear there is not really anything we can do here, not unless we want to slow down Git for Windows dramatically (in most cases, for no good reason)...
…--
(been off-line for a week)
Is this issue (Excel!) something that should get a note in the Known Issues section?
Excel usage is quite common (rhet), though throwing it at this VCS may be less so....
Also, anyone know of other common apps that use this method for change time recording?
Philip
|
Took the plunge and added a note into the FAQ.
Excel file modifications not always noticed.
Excel (and some other apps) do not update the modified time of its files which is used by Git to quickly detect changes. Rather Excel used the change time field. Git will notice the modifications if a git status is performed. See issue 1000 if you need more background.
…----- Original Message -----
From: Philip Oakley
To: git-for-windows/git
Cc: Philip Oakley ; Your activity
Sent: Saturday, May 20, 2017 1:12 PM
Subject: Re: [git-for-windows/git] Certain modifications showing up inconsistently (#1000)
----- Original Message -----
Sorry for the long silence, this ticket simply fell under my radar.
I just tried this, and can confirm. Upon closer inspection using stat test.xls in Git Bash, it would appear that the change time is modifed by Excel along with the bytes on disk, but not the modified time.
I fear that the described problem is related to the fact that Git for Windows has to take a couple of shortcuts when trying to emulate Linux' semantics. In particular, when the so-called "stat" data (essentially, all the metadata for a give file) is emulated, we use the FindFirstFile()/FindNextFile() API which gives us the time of the last access, the time of the last modification and the creation time. Sadly, that differs slightly from the POSIX semantics that Git wants to see, where the first two times are identical, but the ctime does not refer to the creation time but the change time.
But we do not have a fast way to get at the change time, only the access time, modified time and creation time. We could get the change time, via the ChangeTime field in the FILE_BASIC_INFO data structure initialized by GetFileAttributesByHandleEx() function, but that requires a HANDLE, which we can only obtain using CreateFile() (which is orders of magnitude slower than FindFirstFile()/FindNextFile().
So what Git for Windows does is rely on applications to update the modified time when changing any file contents. But that is not the case with Excel.
I fear there is not really anything we can do here, not unless we want to slow down Git for Windows dramatically (in most cases, for no good reason)...
----
(been off-line for a week)
Is this issue (Excel!) something that should get a note in the Known Issues section?
Excel usage is quite common (rhet), though throwing it at this VCS may be less so....
Also, anyone know of other common apps that use this method for change time recording?
Philip
|
I think that would be really nice. Could you open a PR? |
I'll just mark this "up for grabs". Maybe somebody else will be motivated enough to add this valuable information (while I am busy with the non-fun aspects of Git for Windows). |
Just FWIW.
IDK why an Excel file would behave different from any other "Windows" generated file, in this respect. |
I have memory that Excel does things a little differently (but I could be wrong). Also there are many links to determined the last saved date of an excel worksheet via its internal properties. The other option is some form of virus scan (is this on a corporate network) that has 'checked' the file. |
(I tried - sorry if I failed...)
Setup
defaults?
to the issue you're seeing?
Details
git bash
Minimal, Complete, and Verifiable example
this will help us understand the issue.
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 rungit status
before modifying the file.Create a repository, mark
.xls
as binary, add anxls
file:(1) Run
git status
after checkout - modification to file does not show up:(2) Don't run
git status
after checkout - modification to file does show up:In both case (1) and case (2), I expected
test.xls
to show up as modified.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.
URL to that repository to help us with testing?
Repository can be created using commands above. I've attached
test.xls
andtest2.xls
in a zip file -test2.xls
is the result of openingtest.xls
in Excel and then closing it (without explicitly saving).test.zip
The text was updated successfully, but these errors were encountered: