Merge branch 'rs/checkout-init-macro'
Code cleanup. * rs/checkout-init-macro: introduce CHECKOUT_INIT
This commit is contained in:
commit
e683f17e63
4
apply.c
4
apply.c
@ -3334,10 +3334,8 @@ static void prepare_fn_table(struct apply_state *state, struct patch *patch)
|
|||||||
static int checkout_target(struct index_state *istate,
|
static int checkout_target(struct index_state *istate,
|
||||||
struct cache_entry *ce, struct stat *st)
|
struct cache_entry *ce, struct stat *st)
|
||||||
{
|
{
|
||||||
struct checkout costate;
|
struct checkout costate = CHECKOUT_INIT;
|
||||||
|
|
||||||
memset(&costate, 0, sizeof(costate));
|
|
||||||
costate.base_dir = "";
|
|
||||||
costate.refresh_cache = 1;
|
costate.refresh_cache = 1;
|
||||||
costate.istate = istate;
|
costate.istate = istate;
|
||||||
if (checkout_entry(ce, &costate, NULL) || lstat(ce->name, st))
|
if (checkout_entry(ce, &costate, NULL) || lstat(ce->name, st))
|
||||||
|
@ -16,7 +16,7 @@ static int checkout_stage; /* default to checkout stage0 */
|
|||||||
static int to_tempfile;
|
static int to_tempfile;
|
||||||
static char topath[4][TEMPORARY_FILENAME_LENGTH + 1];
|
static char topath[4][TEMPORARY_FILENAME_LENGTH + 1];
|
||||||
|
|
||||||
static struct checkout state;
|
static struct checkout state = CHECKOUT_INIT;
|
||||||
|
|
||||||
static void write_tempfile_record(const char *name, const char *prefix)
|
static void write_tempfile_record(const char *name, const char *prefix)
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ static int checkout_paths(const struct checkout_opts *opts,
|
|||||||
const char *revision)
|
const char *revision)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
struct checkout state;
|
struct checkout state = CHECKOUT_INIT;
|
||||||
static char *ps_matched;
|
static char *ps_matched;
|
||||||
struct object_id rev;
|
struct object_id rev;
|
||||||
struct commit *head;
|
struct commit *head;
|
||||||
@ -352,7 +352,6 @@ static int checkout_paths(const struct checkout_opts *opts,
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Now we are committed to check them out */
|
/* Now we are committed to check them out */
|
||||||
memset(&state, 0, sizeof(state));
|
|
||||||
state.force = 1;
|
state.force = 1;
|
||||||
state.refresh_cache = 1;
|
state.refresh_cache = 1;
|
||||||
state.istate = &the_index;
|
state.istate = &the_index;
|
||||||
|
1
cache.h
1
cache.h
@ -1356,6 +1356,7 @@ struct checkout {
|
|||||||
not_new:1,
|
not_new:1,
|
||||||
refresh_cache:1;
|
refresh_cache:1;
|
||||||
};
|
};
|
||||||
|
#define CHECKOUT_INIT { NULL, "" }
|
||||||
|
|
||||||
#define TEMPORARY_FILENAME_LENGTH 25
|
#define TEMPORARY_FILENAME_LENGTH 25
|
||||||
extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
|
extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
|
||||||
|
@ -1094,12 +1094,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
|
|||||||
int i, ret;
|
int i, ret;
|
||||||
static struct cache_entry *dfc;
|
static struct cache_entry *dfc;
|
||||||
struct exclude_list el;
|
struct exclude_list el;
|
||||||
struct checkout state;
|
struct checkout state = CHECKOUT_INIT;
|
||||||
|
|
||||||
if (len > MAX_UNPACK_TREES)
|
if (len > MAX_UNPACK_TREES)
|
||||||
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
|
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
|
||||||
memset(&state, 0, sizeof(state));
|
|
||||||
state.base_dir = "";
|
|
||||||
state.force = 1;
|
state.force = 1;
|
||||||
state.quiet = 1;
|
state.quiet = 1;
|
||||||
state.refresh_cache = 1;
|
state.refresh_cache = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user