All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: pclouds@gmail.com, git@jeffhostetler.com,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/2] [RFC] Revert/delay performance regression in 'git checkout -b'
Date: Wed, 21 Aug 2019 12:18:32 -0700 (PDT)	[thread overview]
Message-ID: <pull.317.git.gitgitgadget@gmail.com> (raw)

As we were integrating Git 2.23.0 into VFS for Git, we discovered that "git
checkout -b new-branch" went from 0.3s to 10+s on the Windows OS repo. This
was an intentional change when writing the "git switch" builtin. Here is the
commit message for 65f099b ("switch: no worktree status unless real branch
switch happens" 2019-03-29):

When we switch from one branch to another, it makes sense to show a
summary of local changes since there could be conflicts, or some files
left modified.... When switch is used solely for creating a new
branch (and "switch" to the same commit) or detaching, we don't really
need to show anything.

"git checkout" does it anyway for historical reasons. But we can start
with a clean slate with switch and don't have to.

This essentially reverts fa655d8411 (checkout: optimize "git checkout
-b <new_branch>" - 2018-08-16) and make it default for switch,
but also for -B and --detach. Users of big repos are encouraged to
move to switch.

I was considering doing a full, long-term revert of this change to get the
performance back to normal, but I also saw this feedback on the list for
this patch:

I like this last bit. The skip_merge_working_tree() function which
this removes was ugly, difficult to maintain, and difficult to get
just right (and easy to break -- even by changing parts of the system
which one might not expect to impact it).

So, the goal is to reduce the complication given by
skip_merge_working_tree() by recommending that users use 'git switch -c'.
The only problem is: users will take a while to move, unless prompted.

This series does the following:

 1. Reverts the change that makes 'git checkout -b' slow again.
 2. Creates a warning that recommends users start using 'git switch -c'
    instead.

This allows us to strip out this performance feature after users have had
time to adopt the new way of doing things.

Derrick Stolee (2):
  Revert "switch: no worktree status unless real branch switch happens"
  DEPRECATION: warn about 'git checkout -b'

 Documentation/config/checkout.txt |   8 ++
 builtin/checkout.c                | 130 +++++++++++++++++++++++++++++-
 t/t1090-sparse-checkout-scope.sh  |  14 ++++
 3 files changed, 150 insertions(+), 2 deletions(-)


base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-317%2Fderrickstolee%2Frevert-switch-slow-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-317/derrickstolee/revert-switch-slow-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/317
-- 
gitgitgadget

             reply	other threads:[~2019-08-21 19:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 19:18 Derrick Stolee via GitGitGadget [this message]
2019-08-21 19:18 ` [PATCH 1/2] Revert "switch: no worktree status unless real branch switch happens" Derrick Stolee via GitGitGadget
2019-08-21 22:15   ` SZEDER Gábor
2019-08-22 13:41     ` Derrick Stolee
2019-08-21 19:18 ` [PATCH 2/2] DEPRECATION: warn about 'git checkout -b' Derrick Stolee via GitGitGadget
2019-08-22  3:03   ` Elijah Newren
2019-08-21 22:31 ` [PATCH 0/2] [RFC] Revert/delay performance regression in " SZEDER Gábor
2019-08-22  3:18   ` Elijah Newren
2019-08-22 13:43   ` Derrick Stolee
2019-08-22  3:16 ` Elijah Newren
2019-08-22 13:45   ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.317.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.