What is the difference in the INDEX file format compared to the Git bash? [message #1836940] |
Tue, 19 January 2021 06:20  |
Eclipse User |
|
|
|
Hi!
Whenever I use the Git Bash for some commands on a repo that I previously used with Eclipse, the Git Bash refreshes the index file, which takes pretty long on large repos.
Why is this and can I prevent it?
I've expereicnes this with various versions of Git for Windows and Egit. Currently I am on:
- Windows 10 1809
- Git for Windows 2.30.0.windows.2
- Eclipse 2020-12 (4.18.0)
Cheers
Rice
|
|
|
|
|
|
|
|
|
Re: What is the difference in the INDEX file format compared to the Git bash? [message #1837255 is a reply to message #1837178] |
Tue, 26 January 2021 05:18   |
Eclipse User |
|
|
|
Thomas Wolf wrote on Sat, 23 January 2021 12:14
I see no reason for that. Perhaps the output doesn't report nanoseconds if they're zero.
I agree, that's a probable reason. And I cannot remember any line with three zeros in the end.
Thomas Wolf wrote on Sat, 23 January 2021 12:14
Does Git-for-Windows also rebuild the index if it was modified by an Eclipse running with Java 15?
Yes, it does. It says "Refresh index..." and it takes like two minutes for my current repo. And afterwards, the index file differs completely according to WinMerge, BUT the file size remains almost identical. Git-for-Windows seems to only add its additional 200kB if I allow it to create the index from scratch by deleting the old one and saying "git reset --hard" (but that also applies to the Corretto-11-index).
Thomas Wolf wrote on Sat, 23 January 2021 12:14... As you can imagine this carries a high risk of being a time sink...
Can imagine that, yes, but thanks anyway for your fast help here.
|
|
|
Re: What is the difference in the INDEX file format compared to the Git bash? [message #1837436 is a reply to message #1837255] |
Fri, 29 January 2021 16:17  |
Eclipse User |
|
|
|
you can inspect the index using git ls-files and jgit debug-show-dir-cache commands.
The first index entries for the jgit repository look like this (on MacOS 11.1 using adoptopenjdk 1.8.0_275 to run jgit command line) when shown by these commands:
jgit (master)]$ git ls-files --stage --debug
100644 e24be88639b36c35511be54605f47121881dc1a2 0 .bazelrc
ctime: 1611952676:836469104
mtime: 1611952676:836077774
dev: 16777222 ino: 1223328223
uid: 503 gid: 20
size: 370 flags: 0
100644 8faff82c7b0bbf069c53162c726c5ddef4dabe9f 0 .bazelversion
ctime: 1611952677:827111794
mtime: 1611952677:826706063
dev: 16777222 ino: 1223329009
uid: 503 gid: 20
size: 9 flags: 0
100644 f57840b7eec86b91b135afc40f20d950c5d86988 0 .gitattributes
ctime: 1611952675:879064883
mtime: 1611952675:878477372
dev: 16777222 ino: 1223327665
uid: 503 gid: 20
size: 17 flags: 0
...
format of the first line of each entry is
<file mode bits> <sha1 of file blob> <stage> <repo relative path>
find detailed explanations in [1] and [2]
jjgit (master)]$ jgit debug-show-dir-cache
100644 370 2021-01-29,21:37:56.836077774 e24be88639b36c35511be54605f47121881dc1a2 0 .bazelrc
100644 9 2021-01-29,21:37:57.826706063 8faff82c7b0bbf069c53162c726c5ddef4dabe9f 0 .bazelversion
100644 17 2021-01-29,21:37:55.878477372 f57840b7eec86b91b135afc40f20d950c5d86988 0 .gitattributes
...
format of entries with jgit is
<file mode bits> <size> <mtime> <sha1 of file blob> <stage> <repo relative path>
Resolution of file timestamps seen from Java depends on operating system, Java version and
which filesystem is used. See [3].
JGit's DirCache does not use the index fields
- ctime
- dev
- ino
- uid
- gid
[1] https://github.com/git/git/blob/master/Documentation/technical/index-format.txt
[2] https://mincong.io/2018/04/28/git-index/
[3] https://www.youtube.com/watch?v=m44cAozuLNI
https://speakerdeck.com/msohn/racy-jgit-a-short-history-of-time
|
|
|
Powered by
FUDForum. Page generated in 0.05239 seconds