68
int empty_pathspec_ok;
69
int checkout_index;
70
int checkout_worktree;
71
+ const char *ignore_unmerged_opt;
72
+ int ignore_unmerged;
73
74
const char *new_branch;
75
const char *new_branch_force;
411
if (opts->new_branch_log)
412
die(_("'%s' cannot be used with updating paths"), "-l");
413
412
- if (opts->force && opts->patch_mode)
413
- die(_("'%s' cannot be used with updating paths"), "-f");
414
+ if (opts->ignore_unmerged && opts->patch_mode)
415
+ die(_("'%s' cannot be used with updating paths"),
416
+ opts->ignore_unmerged_opt);
417
418
if (opts->force_detach)
419
die(_("'%s' cannot be used with updating paths"), "--detach");
421
if (opts->merge && opts->patch_mode)
422
die(_("'%s' cannot be used with %s"), "--merge", "--patch");
423
421
- if (opts->force && opts->merge)
422
- die(_("'%s' cannot be used with %s"), "-f", "-m");
424
+ if (opts->ignore_unmerged && opts->merge)
425
+ die(_("'%s' cannot be used with %s"),
426
+ opts->ignore_unmerged_opt, "-m");
427
428
if (opts->new_branch)
429
die(_("Cannot update paths and switch to branch '%s' at the same time."),
499
if (ce->ce_flags & CE_MATCHED) {
500
if (!ce_stage(ce))
501
continue;
498
- if (opts->force) {
499
- warning(_("path '%s' is unmerged"), ce->name);
502
+ if (opts->ignore_unmerged) {
503
+ if (!opts->quiet)
504
+ warning(_("path '%s' is unmerged"), ce->name);
505
} else if (opts->writeout_stage) {
506
errs |= check_stage(opts->writeout_stage, ce, pos, opts->overlay_mode);
507
} else if (opts->merge) {
1419
"checkout", "control recursive updating of submodules",
1420
PARSE_OPT_OPTARG, option_parse_recurse_submodules_worktree_updater },
1421
OPT_BOOL(0, "progress", &opts->show_progress, N_("force progress reporting")),
1417
- OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
1418
- PARSE_OPT_NOCOMPLETE),
1422
OPT_BOOL('m', "merge", &opts->merge, N_("perform a 3-way merge with the new branch")),
1423
OPT_STRING(0, "conflict", &opts->conflict_style, N_("style"),
1424
N_("conflict style (merge or diff3)")),
1436
OPT_BOOL('d', "detach", &opts->force_detach, N_("detach HEAD at named commit")),
1437
OPT_SET_INT('t', "track", &opts->track, N_("set upstream info for new branch"),
1438
BRANCH_TRACK_EXPLICIT),
1439
+ OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
1440
+ PARSE_OPT_NOCOMPLETE),
1441
OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
1442
OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
1443
N_("update ignored files (default)"),
1507
opts->merge = 1; /* implied */
1508
git_xmerge_config("merge.conflictstyle", opts->conflict_style, NULL);
1509
}
1505
- if (opts->force)
1510
+ if (opts->force) {
1511
opts->discard_changes = 1;
1512
+ opts->ignore_unmerged_opt = "--force";
1513
+ opts->ignore_unmerged = 1;
1514
+ }
1515
1516
if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1)
1517
die(_("-b, -B and --orphan are mutually exclusive"));
1758
N_("restore the index")),
1759
OPT_BOOL('W', "worktree", &opts.checkout_worktree,
1760
N_("restore the working tree (default)")),
1761
+ OPT_BOOL(0, "ignore-unmerged", &opts.ignore_unmerged,
1762
+ N_("ignore unmerged entries")),
1763
OPT_BOOL(0, "overlay", &opts.overlay_mode, N_("use overlay mode")),
1764
OPT_END()
1765
};
1772
opts.overlay_mode = 0;
1773
opts.checkout_index = -1; /* default off */
1774
opts.checkout_worktree = -2; /* default on */
1775
+ opts.ignore_unmerged_opt = "--ignore-unmerged";
1776
1777
options = parse_options_dup(restore_options);
1778
options = add_common_options(&opts, options);