]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'bp/checkout-new-branch-optim'
authorJunio C Hamano <gitster@pobox.com>
Mon, 17 Sep 2018 20:53:48 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Sep 2018 20:53:48 +0000 (13:53 -0700)
"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 <new_branch>"

1  2 
Documentation/config.txt
builtin/checkout.c

index eb66a119753726b0260acd456f5728351dc05ba3,1a2deeaf20811f23fb346e52cf99b4bdbedf9bf0..69a27eb688167e0c27f6f62bf14c5d5218cc20a8
@@@ -1138,22 -1101,14 +1138,30 @@@ browser.<tool>.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 <something>' and only have one
 +      remote, it may implicitly fall back on checking out and
 +      tracking e.g. 'origin/<something>'. This stops working as soon
 +      as you have more than one remote with a '<something>'
 +      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
 +<something>' will checkout the '<something>' 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 <new_branch>" 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.
index 29ef50013dccbd118093af0b4dc08eb907953cc2,21bac3a561dfa253d54f35f052c83e132396b598..67a83fb95bb5a11acef857bdcd4e07535bb3f073
  #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 [<options>] <branch>"),
        N_("git checkout [<options>] [<branch>] -- <file>..."),