Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 950a9615db..11bf1fcae6 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -808,6 +808,19 @@ int cache_tree_matches_traversal(struct cache_tree *root,
return 0;
}
+static void verify_one_sparse(struct repository *r,
+ struct index_state *istate,
+ struct cache_tree *it,
+ struct strbuf *path,
+ int pos)
+{
+ struct cache_entry *ce = istate->cache[pos];
+
+ if (!S_ISSPARSEDIR(ce->ce_mode))
+ BUG("directory '%s' is present in index, but not sparse",
+ path->buf);
+}
+
static void verify_one(struct repository *r,
struct index_state *istate,
struct cache_tree *it,
@@ -830,6 +843,12 @@ static void verify_one(struct repository *r,
if (path->len) {
pos = index_name_pos(istate, path->buf, path->len);
+
+ if (pos >= 0) {
+ verify_one_sparse(r, istate, it, path, pos);
+ return;
+ }
+
pos = -pos - 1;
} else {
pos = 0;