summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1744820)
raw | patch | inline | side by side (parent: 1744820)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 24 Apr 2006 22:12:42 +0000 (15:12 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 24 Apr 2006 22:12:42 +0000 (15:12 -0700) |
We reused the cache-tree data without verifying the tree object
still exists. Recompute in cache_tree_update() an otherwise
valid cache-tree entry when the tree object disappeared.
This is not usually a problem, but theoretically without this
fix things can break when the user does something like this:
- read-index from a side branch
- write-tree the result
- remove the side branch with "git branch -D"
- remove the unreachable objects with "git prune"
- write-tree what is in the index.
Signed-off-by: Junio C Hamano <junkio@cox.net>
still exists. Recompute in cache_tree_update() an otherwise
valid cache-tree entry when the tree object disappeared.
This is not usually a problem, but theoretically without this
fix things can break when the user does something like this:
- read-index from a side branch
- write-tree the result
- remove the side branch with "git branch -D"
- remove the unreachable objects with "git prune"
- write-tree what is in the index.
Signed-off-by: Junio C Hamano <junkio@cox.net>
cache-tree.c | patch | blob | history |
diff --git a/cache-tree.c b/cache-tree.c
index f6d1dd1d7f8f849d543131bfebb4237bb4f53bd3..b34b0bc3177de67d401f2a91d9355f6751e3d0d4 100644 (file)
--- a/cache-tree.c
+++ b/cache-tree.c
char *buffer;
int i;
- if (0 <= it->entry_count)
+ if (0 <= it->entry_count && has_sha1_file(it->sha1))
return it->entry_count;
/*