summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-16 18:25:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-16 18:25:40 (GMT)
commit788cef81d40070d5755490441abad1a27bc120b7 (patch)
treeebc44e5c83def9855aac4559e87f201882d8f955 /unpack-trees.c
parente0a064a10749a8039f28e9bd3de0ffb5cf99e678 (diff)
parent3e52f70b1505956bf91cb7b107e526d1c67da0a6 (diff)
downloadgit-788cef81d40070d5755490441abad1a27bc120b7.zip
git-788cef81d40070d5755490441abad1a27bc120b7.tar.gz
git-788cef81d40070d5755490441abad1a27bc120b7.tar.bz2
Merge branch 'nd/split-index'
An experiment to use two files (the base file and incremental changes relative to it) to represent the index to reduce I/O cost of rewriting a large index when only small part of the working tree changes. * nd/split-index: (32 commits) t1700: new tests for split-index mode t2104: make sure split index mode is off for the version test read-cache: force split index mode with GIT_TEST_SPLIT_INDEX read-tree: note about dropping split-index mode or index version read-tree: force split-index mode off on --index-output rev-parse: add --shared-index-path to get shared index path update-index --split-index: do not split if $GIT_DIR is read only update-index: new options to enable/disable split index mode split-index: strip pathname of on-disk replaced entries split-index: do not invalidate cache-tree at read time split-index: the reading part split-index: the writing part read-cache: mark updated entries for split index read-cache: save deleted entries in split index read-cache: mark new entries for split index read-cache: split-index mode read-cache: save index SHA-1 after reading entry.c: update cache_changed if refresh_cache is set in checkout_entry() cache-tree: mark istate->cache_changed on prime_cache_tree() cache-tree: mark istate->cache_changed on cache tree update ...
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 0ac39e9..c6aa8fb 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -8,6 +8,7 @@
#include "progress.h"
#include "refs.h"
#include "attr.h"
+#include "split-index.h"
/*
* Error messages expected by scripts out of plumbing commands such as
@@ -241,7 +242,9 @@ static int verify_absent_sparse(const struct cache_entry *ce,
enum unpack_trees_error_types,
struct unpack_trees_options *o);
-static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_options *o)
+static int apply_sparse_checkout(struct index_state *istate,
+ struct cache_entry *ce,
+ struct unpack_trees_options *o)
{
int was_skip_worktree = ce_skip_worktree(ce);
@@ -249,6 +252,10 @@ static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_opt
ce->ce_flags |= CE_SKIP_WORKTREE;
else
ce->ce_flags &= ~CE_SKIP_WORKTREE;
+ if (was_skip_worktree != ce_skip_worktree(ce)) {
+ ce->ce_flags |= CE_UPDATE_IN_BASE;
+ istate->cache_changed |= CE_ENTRY_CHANGED;
+ }
/*
* if (!was_skip_worktree && !ce_skip_worktree()) {
@@ -1009,6 +1016,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
state.force = 1;
state.quiet = 1;
state.refresh_cache = 1;
+ state.istate = &o->result;
memset(&el, 0, sizeof(el));
if (!core_apply_sparse_checkout || !o->update)
@@ -1025,6 +1033,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->result.timestamp.sec = o->src_index->timestamp.sec;
o->result.timestamp.nsec = o->src_index->timestamp.nsec;
o->result.version = o->src_index->version;
+ o->result.split_index = o->src_index->split_index;
+ if (o->result.split_index)
+ o->result.split_index->refcount++;
+ hashcpy(o->result.sha1, o->src_index->sha1);
o->merge_size = len;
mark_all_ce_unused(o->src_index);
@@ -1115,7 +1127,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
ret = -1;
}
- if (apply_sparse_checkout(ce, o)) {
+ if (apply_sparse_checkout(&o->result, ce, o)) {
if (!o->show_all_errors)
goto return_failed;
ret = -1;
@@ -1243,7 +1255,7 @@ static void invalidate_ce_path(const struct cache_entry *ce,
struct unpack_trees_options *o)
{
if (ce)
- cache_tree_invalidate_path(o->src_index->cache_tree, ce->name);
+ cache_tree_invalidate_path(o->src_index, ce->name);
}
/*