revert "checkout: introduce checkout.overlayMode config"

This reverts 1495ff7da5 ("checkout: introduce checkout.overlayMode config", 2019-01-08) and thus removes the checkout.overlayMode config option. The option was originally introduced to give users the option to make the new no-overlay behaviour the default. However users may be using 'git checkout' in scripts, even though it is porcelain. Users setting the option to false may actually end up accidentally breaking scripts. With the introduction of a new subcommand that will make the behaviour the default, the config option will not be needed anymore anyway. Revert the commit and remove the config option, so we don't risk breaking scripts. Suggested-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Gummerer committed Feb 4, 2019 at 21:13 UTC e92aa0e4ef5a91781530449f9466a45c16c91f7f
3 files changed +1 -24
Documentation/config/checkout.txt
-7
@@ -21,10 +21,3 @@ checkout.optimizeNewBranch::
21 will not update the skip-worktree bit in the index nor add/remove
22 files in the working directory to reflect the current sparse checkout
23 settings nor will it show the local changes.
24 -
25 -checkout.overlayMode::
26 - In the default overlay mode, `git checkout` never
27 - removes files from the index or the working tree. When
28 - setting `checkout.overlayMode` to false, files that appear in
29 - the index and working tree, but not in <tree-ish> are removed,
30 - to make them match <tree-ish> exactly.
builtin/checkout.c
+1 -7
@@ -1019,19 +1019,13 @@ static int switch_branches(const struct checkout_opts *opts,
1019
1020 static int git_checkout_config(const char *var, const char *value, void *cb)
1021 {
1022 - struct checkout_opts *opts = cb;
1023 -
1022 if (!strcmp(var, "checkout.optimizenewbranch")) {
1023 checkout_optimize_new_branch = git_config_bool(var, value);
1024 return 0;
1025 }
1026
1029 - if (!strcmp(var, "checkout.overlaymode")) {
1030 - opts->overlay_mode = git_config_bool(var, value);
1031 - return 0;
1032 - }
1033 -
1027 if (!strcmp(var, "diff.ignoresubmodules")) {
1028 + struct checkout_opts *opts = cb;
1029 handle_ignore_submodules_arg(&opts->diff_options, value);
1030 return 0;
1031 }
t/t2025-checkout-no-overlay.sh
-10
@@ -44,14 +44,4 @@ test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '
44 test_path_is_missing file1
45 '
46
47 -test_expect_success 'checkout with checkout.overlayMode=false deletes files not in <tree-ish>' '
48 - >file &&
49 - mkdir dir &&
50 - >dir/file1 &&
51 - git add file dir/file1 &&
52 - git -c checkout.overlayMode=false checkout HEAD -- file &&
53 - test_path_is_missing file &&
54 - test_path_is_file dir/file1
55 -'
56 -
47 test_done