summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/repository.c b/repository.c
index 34610c5a33..5d166b692c 100644
--- a/repository.c
+++ b/repository.c
@@ -240,6 +240,20 @@ out:
return ret;
}
+static void repo_clear_path_cache(struct repo_path_cache *cache)
+{
+ FREE_AND_NULL(cache->squash_msg);
+ FREE_AND_NULL(cache->squash_msg);
+ FREE_AND_NULL(cache->merge_msg);
+ FREE_AND_NULL(cache->merge_rr);
+ FREE_AND_NULL(cache->merge_mode);
+ FREE_AND_NULL(cache->merge_head);
+ FREE_AND_NULL(cache->merge_autostash);
+ FREE_AND_NULL(cache->auto_merge);
+ FREE_AND_NULL(cache->fetch_head);
+ FREE_AND_NULL(cache->shallow);
+}
+
void repo_clear(struct repository *repo)
{
FREE_AND_NULL(repo->gitdir);
@@ -280,6 +294,8 @@ void repo_clear(struct repository *repo)
remote_state_clear(repo->remote_state);
FREE_AND_NULL(repo->remote_state);
}
+
+ repo_clear_path_cache(&repo->cached_paths);
}
int repo_read_index(struct repository *repo)
@@ -301,6 +317,13 @@ int repo_read_index(struct repository *repo)
if (repo->settings.command_requires_full_index)
ensure_full_index(repo->index);
+ /*
+ * If sparse checkouts are in use, check whether paths with the
+ * SKIP_WORKTREE attribute are missing from the worktree; if not,
+ * clear that attribute for that path.
+ */
+ clear_skip_worktree_from_present_files(repo->index);
+
return res;
}