diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-23 18:28:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-23 18:28:37 -0700 |
commit | d6096f17d2d5d9ccb453aabf8edc6ee238b166fc (patch) | |
tree | 0699a406f367814d799817402044b89c44491d97 /read-cache.c | |
parent | a7b3269c4b9acde052d75b6dc54c8f869b77eb44 (diff) | |
parent | 913e0e99b6a6e63af6a062622a1f94bd78fd8052 (diff) | |
download | git-d6096f17d2d5d9ccb453aabf8edc6ee238b166fc.tar.gz |
Merge branch 'maint'
* maint:
unpack_trees(): protect the handcrafted in-core index from read_cache()
git-p4: Fix one-liner in p4_write_pipe function.
Completion: add missing '=' for 'diff --diff-filter'
Fix 'git help help'
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c index f0ba224798..a857c8e12f 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1159,7 +1159,7 @@ int read_index_from(struct index_state *istate, const char *path) size_t mmap_size; errno = EBUSY; - if (istate->alloc) + if (istate->initialized) return istate->cache_nr; errno = ENOENT; @@ -1199,6 +1199,7 @@ int read_index_from(struct index_state *istate, const char *path) * index size */ istate->alloc = xmalloc(estimate_cache_size(mmap_size, istate->cache_nr)); + istate->initialized = 1; src_offset = sizeof(*hdr); dst_offset = 0; @@ -1251,6 +1252,7 @@ int discard_index(struct index_state *istate) cache_tree_free(&(istate->cache_tree)); free(istate->alloc); istate->alloc = NULL; + istate->initialized = 0; /* no need to throw away allocated active_cache */ return 0; |