aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-07 09:59:56 +0900
committerJunio C Hamano <gitster@pobox.com>2019-03-07 09:59:56 +0900
commit0efa3d74e705ed2c66c33854ac4bfd0d6c7f56de (patch)
treeef2634edad53b83fd6aea32a325da6a03d821149 /read-cache.c
parentebf846c0086114714c0162c4dc8acbf344740c1d (diff)
parent6e37c8ed3c899385651f5beac1f1588fe3c1f5fb (diff)
downloadgit-0efa3d74e705ed2c66c33854ac4bfd0d6c7f56de.tar.gz
Merge branch 'nd/split-index-null-base-fix'
Split-index fix. * nd/split-index-null-base-fix: read-cache.c: fix writing "link" index ext with null base oid
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 75ff234fc8..441537032f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2900,7 +2900,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
return -1;
}
- if (!strip_extensions && istate->split_index) {
+ if (!strip_extensions && istate->split_index &&
+ !is_null_oid(&istate->split_index->base_oid)) {
struct strbuf sb = STRBUF_INIT;
err = write_link_extension(&sb, istate) < 0 ||
@@ -3195,7 +3196,7 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
ret = write_split_index(istate, lock, flags);
/* Freshen the shared index only if the split-index was written */
- if (!ret && !new_shared_index) {
+ if (!ret && !new_shared_index && !is_null_oid(&si->base_oid)) {
const char *shared_index = git_path("sharedindex.%s",
oid_to_hex(&si->base_oid));
freshen_shared_index(shared_index, 1);