diff options
| author | Scott J. Goldman <scottjg@github.com> | 2013-01-24 18:53:08 -0800 |
|---|---|---|
| committer | Scott J. Goldman <scottjg@github.com> | 2013-01-24 18:55:39 -0800 |
| commit | 5425097f0368c43e72210c33b844cf7350843c37 (patch) | |
| tree | ec614af448b0d24ac0b0297242e4eba65b3ceb00 /src/index.c | |
| parent | 2ff4469afc1e3e142d68c46e3c15e889fe32582a (diff) | |
| download | libgit2-5425097f0368c43e72210c33b844cf7350843c37.tar.gz | |
index: Speed up loading a tree into the index
The index is empty; repeated tree entries cannot collide.
cc github/gitrpc#83
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/index.c b/src/index.c index 76384288e..e9dffab8d 100644 --- a/src/index.c +++ b/src/index.c @@ -386,8 +386,7 @@ int git_index_set_caps(git_index *index, unsigned int caps) index->no_symlinks = ((caps & GIT_INDEXCAP_NO_SYMLINKS) != 0); } - if (old_ignore_case != index->ignore_case) - { + if (old_ignore_case != index->ignore_case) { index_set_ignore_case(index, index->ignore_case); } @@ -1649,10 +1648,16 @@ static int read_tree_cb(const char *root, const git_tree_entry *tentry, void *da entry->mode = tentry->attr; entry->oid = tentry->oid; + + if (path.size < GIT_IDXENTRY_NAMEMASK) + entry->flags = path.size & GIT_IDXENTRY_NAMEMASK; + else + entry->flags = GIT_IDXENTRY_NAMEMASK; + entry->path = git_buf_detach(&path); git_buf_free(&path); - if (index_insert(index, entry, 0) < 0) { + if (git_vector_insert(&index->entries, entry) < 0) { index_entry_free(entry); return -1; } |
