-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Support index v4 #3789
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
Support index v4 #3789
Conversation
@@ -434,6 +437,7 @@ int git_index_open(git_index **index_out, const char *index_path) | |||
index->entries_search = git_index_entry_srch; | |||
index->entries_search_path = index_entry_srch_path; | |||
index->reuc_search = reuc_srch; | |||
index->version = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using INDEX_VERSION_NUMBER
instead of magic number 2?
Is it worth not adding the hooks in the test repo that should be unused? |
I'd also love to see a couple of tests for the varint encoding / decoding. |
58f4fa1
to
482077e
Compare
I addressed these. |
Hm, this AppVeyor failure seems to be bogus -- it's operating on the previous version of the patch. This version uses 251-character filenames (I meant to do 257, but somehow screwed it up). But AppVeyor is still trying to check out the >260 char names. I guess I'll add six chars to the names to make them 257 (I want to exceed 256 to ensure that the varint thing is really working right), and hope AppVeyor gets its act together. |
Just FYI: it's not a 260 character limit on the filename, it's a 260 character limit on the entire path. |
482077e
to
f5a4659
Compare
Hm, it seems to be a limit on the absolute path, which is insane. But I have no idea what the absolute path length is. Also I broke this one because I forgot to change the test code. OK, forget long filenames -- we'll just do short ones and assume that the varint stuff works OK. |
This code is ported from git.git Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: David Turner <[email protected]>
f5a4659
to
d4ec738
Compare
Do we need the new repository? Why not add a second index file to an existing with with v4? |
@dturner-tw The test seems useful, it's easy enough to |
@ethomson naturally, skipping it on Windows was my first thought, but no dice -- merely having the file in the libgit2 repo was enough to make AppVeyor unable to check out libgit2 on msys. (Yeah, we could probably do some hack where the repo is storred bare and then we clone a non-bare copy, but that seems like a giant hassle). |
@carlosmn I guess we don't need it anymore, now that we've eliminated the long filenames. Will amend. |
Support reading and writing index v4. Index v4 uses a very simple compression scheme for pathnames, but is otherwise similar to index v3. Signed-off-by: David Turner <[email protected]>
d4ec738
to
da2638c
Compare
@ethomson Given the limitations of AppVeyor, can we use merge version? |
Ah, right you are. Indeed, this seems unnecessary. This is really helpful, I appreciate you doing this. I have a couple of (minor) comments before we merge this... is this something that you're still able to work on? |
Until June 3, yes. |
It occurs to me that perhaps you meant "is this something you're willing to support". And the answer is yes, I'm willing to support it even after today. Tag @novalis (my non-twitter github account) with questions. |
Yes - I'm sorry if I was unclear, I noticed your message to the git mailing list and wasn't sure if you were dropping the metaphorical mic and walking out and didn't want to be bothered with git-type-things any longer. :) If not I was going to make a few tweaks myself. But since you are that's great, I'll write up some comments / minor requests when I have a moment. (Sorry about the delay - I missed the notification for your first message, and I'm not going to be in front of a computer much for the next week, but I'll try to get these to you as soon as I can.) Thanks again. |
@@ -13,6 +15,9 @@ v0.24 + 1 | |||
writing into a stream. Useful when you do not know the final size or | |||
want to copy the contents from another stream. | |||
|
|||
* `git_index_version()` and `git_set_index_version()` to get and set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here - the function is git_index_set_version
.
|
||
path_len = ((struct entry_internal *)entry)->pathlen; | ||
|
||
if (last) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the callers pass this so this check seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's null if index->version < INDEX_VERSION_NUMBER_COMP
Apologies that this took so long to get back to you. Day jobs, amirite? This will be very nice to have - I had some stylistic complaints, mostly just very minor nitpicking. Thanks again. |
moved to #3837 -- please close this one. |
This PR includes code from Junio, which seems to be permitted.