summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/repository.c b/repository.c
index beff3caa9e..02fe884603 100644
--- a/repository.c
+++ b/repository.c
@@ -238,7 +238,8 @@ void repo_clear(struct repository *repo)
if (repo->index) {
discard_index(repo->index);
- FREE_AND_NULL(repo->index);
+ if (repo->index != &the_index)
+ FREE_AND_NULL(repo->index);
}
}