builtin-checkout.c: check error return from read_cache()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -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));
|
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
||||||
|
|
||||||
newfd = hold_locked_index(lock_file, 1);
|
newfd = hold_locked_index(lock_file, 1);
|
||||||
read_cache();
|
if (read_cache() < 0)
|
||||||
|
return error("corrupt index file");
|
||||||
|
|
||||||
if (source_tree)
|
if (source_tree)
|
||||||
read_tree_some(source_tree, pathspec);
|
read_tree_some(source_tree, pathspec);
|
||||||
@ -371,7 +372,9 @@ static int merge_working_tree(struct checkout_opts *opts,
|
|||||||
int ret;
|
int ret;
|
||||||
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
||||||
int newfd = hold_locked_index(lock_file, 1);
|
int newfd = hold_locked_index(lock_file, 1);
|
||||||
read_cache();
|
|
||||||
|
if (read_cache() < 0)
|
||||||
|
return error("corrupt index file");
|
||||||
|
|
||||||
if (opts->force) {
|
if (opts->force) {
|
||||||
ret = reset_tree(new->commit->tree, opts, 1);
|
ret = reset_tree(new->commit->tree, opts, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user