Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-03-29 13:39:03 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-02 07:56:59 +0300
commit55cf704a9d139bca0cb5cca1bf047eb043e13bd2 (patch)
tree8fafc9848dfb2f2009e14cdf1717daf49b3e9d10 /builtin/checkout.c
parentb3edccb967ab4531e6a5fd20610a3be93be01c70 (diff)
checkout: move 'confict_style' and 'dwim_..' to checkout_opts
These local variables are referenced by struct option[]. This struct will soon be broken down, moved away and we can't rely on local variables anymore. Move these two to struct checkout_opts in preparation for that. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index b6de8401fe..93fc2a5815 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -47,6 +47,8 @@ struct checkout_opts {
int show_progress;
int count_checkout_paths;
int overlay_mode;
+ int no_dwim_new_local_branch;
+
/*
* If new checkout options are added, skip_merge_working_tree
* should be updated accordingly.
@@ -58,6 +60,7 @@ struct checkout_opts {
int new_branch_log;
enum branch_track track;
struct diff_options diff_options;
+ char *conflict_style;
int branch_exists;
const char *prefix;
@@ -1344,8 +1347,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
struct checkout_opts real_opts;
struct checkout_opts *opts = &real_opts;
struct branch_info new_branch_info;
- char *conflict_style = NULL;
- int dwim_new_local_branch, no_dwim_new_local_branch = 0;
+ int dwim_new_local_branch;
int dwim_remotes_matched = 0;
struct option options[] = {
OPT__QUIET(&opts->quiet, N_("suppress progress reporting")),
@@ -1370,12 +1372,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
N_("update ignored files (default)"),
PARSE_OPT_NOCOMPLETE),
- OPT_STRING(0, "conflict", &conflict_style, N_("style"),
+ OPT_STRING(0, "conflict", &opts->conflict_style, N_("style"),
N_("conflict style (merge or diff3)")),
OPT_BOOL('p', "patch", &opts->patch_mode, N_("select hunks interactively")),
OPT_BOOL(0, "ignore-skip-worktree-bits", &opts->ignore_skipworktree,
N_("do not limit pathspecs to sparse entries only")),
- OPT_BOOL(0, "no-guess", &no_dwim_new_local_branch,
+ OPT_BOOL(0, "no-guess", &opts->no_dwim_new_local_branch,
N_("do not second guess 'git checkout <no-such-branch>'")),
OPT_BOOL(0, "ignore-other-worktrees", &opts->ignore_other_worktrees,
N_("do not check if another worktree is holding the given ref")),
@@ -1393,6 +1395,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
opts->prefix = prefix;
opts->show_progress = -1;
opts->overlay_mode = -1;
+ opts->no_dwim_new_local_branch = 0;
git_config(git_checkout_config, opts);
@@ -1401,7 +1404,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, options, checkout_usage,
PARSE_OPT_KEEP_DASHDASH);
- dwim_new_local_branch = !no_dwim_new_local_branch;
+ dwim_new_local_branch = !opts->no_dwim_new_local_branch;
if (opts->show_progress < 0) {
if (opts->quiet)
opts->show_progress = 0;
@@ -1409,9 +1412,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
opts->show_progress = isatty(2);
}
- if (conflict_style) {
+ if (opts->conflict_style) {
opts->merge = 1; /* implied */
- git_xmerge_config("merge.conflictstyle", conflict_style, NULL);
+ git_xmerge_config("merge.conflictstyle", opts->conflict_style, NULL);
}
if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1)