X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-checkout.c;h=c2c05613b67d7cc8bd3500bdbca4fc3533afaeee;hb=cec08717cca468c66eb454c7201fd35f54b48a58;hp=7f3bd7bb1cb8f211c78067df9376541e0aa3f923;hpb=fe60dff744aa9fc7440de0a521e8be71ec35a059;p=git.git diff --git a/builtin-checkout.c b/builtin-checkout.c index 7f3bd7bb1..c2c05613b 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -228,7 +228,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec, struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); newfd = hold_locked_index(lock_file, 1); - read_cache(); + if (read_cache() < 0) + return error("corrupt index file"); if (source_tree) read_tree_some(source_tree, pathspec); @@ -371,7 +372,9 @@ static int merge_working_tree(struct checkout_opts *opts, int ret; struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); int newfd = hold_locked_index(lock_file, 1); - read_cache(); + + if (read_cache() < 0) + return error("corrupt index file"); if (opts->force) { ret = reset_tree(new->commit->tree, opts, 1);