author | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Apr 2009 10:58:17 +0000 (03:58 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Apr 2009 11:16:40 +0000 (04:16 -0700) | ||
commit | 8cc21ce78c2f3781024117047c0650861f890213 | |
tree | e0d6ba9e39e77bf56d5977a26b60b50bc351ddb7 | tree | snapshot |
parent | 1f9b620fdbf27835f54b11008d64c4014b8f4c32 | commit | diff |
read-tree A B: do not corrupt cache-tree
An earlier commit aab3b9a (read-tree A B C: do not create a bogus index
and do not segfault, 2009-03-12) resurrected the support for an obscure
(but useful) feature to read and overlay more than one tree into the index
without the -m (merge) option. But the fix was not enough.
Exercising this feature exposes a longstanding bug in the code that primes
the cache-tree in the index from the tree that was read. The intention
was that when we know that the index must exactly match the tree we just
read, we prime the entire cache-tree with it.
However, the logic to detect that case incorrectly triggered if you read
two trees without -m. This resulted in a corrupted cache-tree, and
write-tree would have produced an incorrect tree object out of such an
index.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
An earlier commit aab3b9a (read-tree A B C: do not create a bogus index
and do not segfault, 2009-03-12) resurrected the support for an obscure
(but useful) feature to read and overlay more than one tree into the index
without the -m (merge) option. But the fix was not enough.
Exercising this feature exposes a longstanding bug in the code that primes
the cache-tree in the index from the tree that was read. The intention
was that when we know that the index must exactly match the tree we just
read, we prime the entire cache-tree with it.
However, the logic to detect that case incorrectly triggered if you read
two trees without -m. This resulted in a corrupted cache-tree, and
write-tree would have produced an incorrect tree object out of such an
index.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-read-tree.c | diff | blob | history |