unpack-trees.c: generalize verify_* functions
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e663db2f44
commit
35a5aa79d0
@ -452,8 +452,9 @@ static int same(struct cache_entry *a, struct cache_entry *b)
|
|||||||
* When a CE gets turned into an unmerged entry, we
|
* When a CE gets turned into an unmerged entry, we
|
||||||
* want it to be up-to-date
|
* want it to be up-to-date
|
||||||
*/
|
*/
|
||||||
static int verify_uptodate(struct cache_entry *ce,
|
static int verify_uptodate_1(struct cache_entry *ce,
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o,
|
||||||
|
const char *error_msg)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@ -478,7 +479,13 @@ static int verify_uptodate(struct cache_entry *ce,
|
|||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
return o->gently ? -1 :
|
return o->gently ? -1 :
|
||||||
error(ERRORMSG(o, not_uptodate_file), ce->name);
|
error(error_msg, ce->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int verify_uptodate(struct cache_entry *ce,
|
||||||
|
struct unpack_trees_options *o)
|
||||||
|
{
|
||||||
|
return verify_uptodate_1(ce, o, ERRORMSG(o, not_uptodate_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void invalidate_ce_path(struct cache_entry *ce, struct unpack_trees_options *o)
|
static void invalidate_ce_path(struct cache_entry *ce, struct unpack_trees_options *o)
|
||||||
@ -586,8 +593,9 @@ static int icase_exists(struct unpack_trees_options *o, struct cache_entry *dst,
|
|||||||
* We do not want to remove or overwrite a working tree file that
|
* We do not want to remove or overwrite a working tree file that
|
||||||
* is not tracked, unless it is ignored.
|
* is not tracked, unless it is ignored.
|
||||||
*/
|
*/
|
||||||
static int verify_absent(struct cache_entry *ce, const char *action,
|
static int verify_absent_1(struct cache_entry *ce, const char *action,
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o,
|
||||||
|
const char *error_msg)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@ -667,6 +675,11 @@ static int verify_absent(struct cache_entry *ce, const char *action,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static int verify_absent(struct cache_entry *ce, const char *action,
|
||||||
|
struct unpack_trees_options *o)
|
||||||
|
{
|
||||||
|
return verify_absent_1(ce, action, o, ERRORMSG(o, would_lose_untracked));
|
||||||
|
}
|
||||||
|
|
||||||
static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
|
static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o)
|
||||||
|
Loading…
Reference in New Issue
Block a user