unpack_callback(): use unpack_failed() consistently
When unpack_index_entry() failed, consistently call unpack_failed(), instead of silently returning -1. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6caa7b5553
commit
353c5eeb5c
@ -277,6 +277,17 @@ static int unpack_nondirectories(int n, unsigned long mask,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int unpack_failed(struct unpack_trees_options *o, const char *message)
|
||||||
|
{
|
||||||
|
discard_index(&o->result);
|
||||||
|
if (!o->gently) {
|
||||||
|
if (message)
|
||||||
|
return error("%s", message);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
|
static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
|
||||||
{
|
{
|
||||||
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
|
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
|
||||||
@ -294,7 +305,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
|
|||||||
int cmp = compare_entry(ce, info, p);
|
int cmp = compare_entry(ce, info, p);
|
||||||
if (cmp < 0) {
|
if (cmp < 0) {
|
||||||
if (unpack_index_entry(ce, o) < 0)
|
if (unpack_index_entry(ce, o) < 0)
|
||||||
return -1;
|
return unpack_failed(o, NULL);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cmp) {
|
if (!cmp) {
|
||||||
@ -352,17 +363,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unpack_failed(struct unpack_trees_options *o, const char *message)
|
|
||||||
{
|
|
||||||
discard_index(&o->result);
|
|
||||||
if (!o->gently) {
|
|
||||||
if (message)
|
|
||||||
return error("%s", message);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* N-way merge "len" trees. Returns 0 on success, -1 on failure to manipulate the
|
* N-way merge "len" trees. Returns 0 on success, -1 on failure to manipulate the
|
||||||
* resulting index, -2 on failure to reflect the changes to the work tree.
|
* resulting index, -2 on failure to reflect the changes to the work tree.
|
||||||
|
Loading…
Reference in New Issue
Block a user