summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 19:19:35 +0700
committerJunio C Hamano <gitster@pobox.com>2014-06-13 11:49:39 -0700
commite93021b20a73af8ff51f9ddd8c98f44fd103f360 (patch)
tree81eac1241c7421e98d705fba74ebb4e76f8faca4 /unpack-trees.c
parentd4a2024aef90fa5dd2b0e5027f9340719ff20748 (diff)
downloadgit-e93021b20a73af8ff51f9ddd8c98f44fd103f360.tar.gz
read-cache: save index SHA-1 after reading
Also update SHA-1 after writing. If we do not do that, the second read_index() will see "initialized" variable already set and not read .git/index again, which is fine, except istate->sha1 now has a stale value. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 26f65c72fd..f594932080 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1046,6 +1046,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->result.timestamp.sec = o->src_index->timestamp.sec;
o->result.timestamp.nsec = o->src_index->timestamp.nsec;
o->result.version = o->src_index->version;
+ hashcpy(o->result.sha1, o->src_index->sha1);
o->merge_size = len;
mark_all_ce_unused(o->src_index);