From: Junio C Hamano Date: Mon, 17 Sep 2018 20:53:48 +0000 (-0700) Subject: Merge branch 'bp/checkout-new-branch-optim' X-Git-Tag: v2.20.0-rc0~254 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0faaf7eafcd87c1e0b00e97018740153a048291a?ds=inline;hp=--cc Merge branch 'bp/checkout-new-branch-optim' "git checkout -b newbranch [HEAD]" should not have to do as much as checking out a commit different from HEAD. An attempt is made to optimize this special case. * bp/checkout-new-branch-optim: checkout: optimize "git checkout -b " --- 0faaf7eafcd87c1e0b00e97018740153a048291a diff --cc Documentation/config.txt index eb66a11975,1a2deeaf20..69a27eb688 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -1138,22 -1101,14 +1138,30 @@@ browser..path: browse HTML help (see `-w` option in linkgit:git-help[1]) or a working repository in gitweb (see linkgit:git-instaweb[1]). +checkout.defaultRemote:: + When you run 'git checkout ' and only have one + remote, it may implicitly fall back on checking out and + tracking e.g. 'origin/'. This stops working as soon + as you have more than one remote with a '' + reference. This setting allows for setting the name of a + preferred remote that should always win when it comes to + disambiguation. The typical use-case is to set this to + `origin`. ++ +Currently this is used by linkgit:git-checkout[1] when 'git checkout +' will checkout the '' branch on another remote, +and by linkgit:git-worktree[1] when 'git worktree add' refers to a +remote branch. This setting might be used for other checkout-like +commands or functionality in the future. + + checkout.optimizeNewBranch + Optimizes the performance of "git checkout -b " when + using sparse-checkout. When set to true, git will not update the + repo based on the current sparse-checkout settings. This means it + will not update the skip-worktree bit in the index nor add/remove + files in the working directory to reflect the current sparse checkout + settings nor will it show the local changes. + clean.requireForce:: A boolean to make git-clean do nothing unless given -f, -i or -n. Defaults to true. diff --cc builtin/checkout.c index 29ef50013d,21bac3a561..67a83fb95b --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -23,8 -23,9 +23,10 @@@ #include "resolve-undo.h" #include "submodule-config.h" #include "submodule.h" +#include "advice.h" + static int checkout_optimize_new_branch; + static const char * const checkout_usage[] = { N_("git checkout [] "), N_("git checkout [] [] -- ..."),