Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
wants to merge 2 commits into from
Closed

Conversation

dturner-tw
Copy link
Contributor

This PR includes code from Junio, which seems to be permitted.

@@ -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;
Copy link
Contributor

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?

@mikeando
Copy link
Contributor

Is it worth not adding the hooks in the test repo that should be unused?

@mikeando
Copy link
Contributor

I'd also love to see a couple of tests for the varint encoding / decoding.

@dturner-tw
Copy link
Contributor Author

I addressed these.

@dturner-tw
Copy link
Contributor Author

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.

@ethomson
Copy link
Member

Just FYI: it's not a 260 character limit on the filename, it's a 260 character limit on the entire path.

@dturner-tw
Copy link
Contributor Author

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]>
@carlosmn
Copy link
Member

Do we need the new repository? Why not add a second index file to an existing with with v4?

@ethomson
Copy link
Member

@dturner-tw The test seems useful, it's easy enough to clar_skip it on Windows and run it only on sane operating systems.

@dturner-tw
Copy link
Contributor Author

@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).

@dturner-tw
Copy link
Contributor Author

@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]>
@dturner-tw
Copy link
Contributor Author

@ethomson Given the limitations of AppVeyor, can we use merge version?

@ethomson
Copy link
Member

(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).

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?

@dturner-tw
Copy link
Contributor Author

Until June 3, yes.

@dturner-tw
Copy link
Contributor Author

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.

@ethomson
Copy link
Member

ethomson commented Jun 4, 2016

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
Copy link
Member

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) {
Copy link
Member

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.

Copy link
Contributor

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

@ethomson
Copy link
Member

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.

@novalis novalis mentioned this pull request Jun 25, 2016
@novalis
Copy link
Contributor

novalis commented Jun 25, 2016

moved to #3837 -- please close this one.

@ethomson ethomson closed this Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants