From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Ben Peart <peartben@gmail.com>
Cc: git@vger.kernel.org, benpeart@microsoft.com, asottile@umich.edu,
pclouds@gmail.com, gitster@pobox.com
Subject: Re: [PATCH v1 2/2] checkout: fix regression in checkout -b on intitial checkout
Date: Sat, 19 Jan 2019 01:52:02 +0100 [thread overview]
Message-ID: <20190119005202.GO840@szeder.dev> (raw)
In-Reply-To: <20190118185558.17688-3-peartben@gmail.com>
On Fri, Jan 18, 2019 at 01:55:58PM -0500, Ben Peart wrote:
> From: Ben Peart <benpeart@microsoft.com>
>
> When doing a 'checkout -b' do a full checkout including updating the working
> tree when doing the initial checkout. This fixes the regression in behavior
> caused by fa655d8411 checkout: optimize "git checkout -b <new_branch>"
>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
> builtin/checkout.c | 6 ++++++
> t/t2018-checkout-branch.sh | 2 +-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 6fadf412e8..af6b5c8336 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -517,6 +517,12 @@ static int skip_merge_working_tree(const struct checkout_opts *opts,
> if (core_apply_sparse_checkout && !checkout_optimize_new_branch)
> return 0;
>
> + /*
> + * We must do the merge if this is the initial checkout
> + */
> + if (is_cache_unborn())
> + return 0;
> +
> /*
> * We must do the merge if we are actually moving to a new commit.
> */
This patch breaks 'checkout -b checkout.optimizeNewBranch interaction'
in 't1090-sparse-checkout-scope.sh':
+ cp .git/info/sparse-checkout .git/info/sparse-checkout.bak
+ test_when_finished
mv -f .git/info/sparse-checkout.bak .git/info/sparse-checkout
git checkout master
+ test 0 = 0
+ test_cleanup={
mv -f .git/info/sparse-checkout.bak .git/info/sparse-checkout
git checkout master
} && (exit "$eval_ret"); eval_ret=$?; :
+ echo /b
+ git ls-files -t b
+ test S b = S b
+ git -c checkout.optimizeNewBranch=true checkout -b fast
Switched to a new branch 'fast'
+ git ls-files -t b
+ test H b = S b
error: last command exited with $?=1
not ok 4 - checkout -b checkout.optimizeNewBranch interaction
next prev parent reply other threads:[~2019-01-19 0:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-01 23:17 Regression `git checkout $rev -b branch` while in a `--no-checkout` clone does not check out files Anthony Sottile
2019-01-02 11:08 ` Duy Nguyen
2019-01-02 16:18 ` Anthony Sottile
2019-01-03 10:04 ` Duy Nguyen
2019-01-03 20:25 ` Junio C Hamano
2019-01-03 20:35 ` Anthony Sottile
2019-01-03 21:51 ` Junio C Hamano
2019-01-03 22:05 ` Anthony Sottile
2019-01-16 14:39 ` Ben Peart
2019-01-18 18:55 ` [PATCH v1 0/2] Fix regression in checkout -b Ben Peart
2019-01-18 18:55 ` [PATCH v1 1/2] checkout: add test to demonstrate regression with checkout -b on initial commit Ben Peart
2019-01-18 19:23 ` SZEDER Gábor
2019-01-18 18:55 ` [PATCH v1 2/2] checkout: fix regression in checkout -b on intitial checkout Ben Peart
2019-01-18 20:00 ` Junio C Hamano
2019-01-19 0:52 ` SZEDER Gábor [this message]
2019-01-19 1:26 ` [PATCH v1 0/2] Fix regression in checkout -b Junio C Hamano
2019-01-21 19:50 ` [PATCH v2 " Ben Peart
2019-01-21 19:50 ` [PATCH v2 1/2] checkout: add test to demonstrate regression with checkout -b on initial commit Ben Peart
2019-01-23 17:57 ` SZEDER Gábor
2019-01-21 19:50 ` [PATCH v2 2/2] checkout: fix regression in checkout -b on intitial checkout Ben Peart
2019-01-22 14:35 ` Johannes Schindelin
2019-01-22 18:42 ` Junio C Hamano
2019-01-22 18:49 ` Jeff King
2019-01-22 18:54 ` [PATCH v2 0/2] Fix regression in checkout -b Junio C Hamano
2019-01-22 19:31 ` Ben Peart
2019-01-23 19:14 ` Junio C Hamano
2019-01-23 20:01 ` [PATCH v3 " Ben Peart
2019-01-23 20:02 ` [PATCH v3 1/2] checkout: add test demonstrating regression with checkout -b on initial commit Ben Peart
2019-01-23 20:02 ` [PATCH v3 2/2] checkout: fix regression in checkout -b on intitial checkout Ben Peart
2019-01-23 21:23 ` [PATCH v3 0/2] Fix regression in checkout -b Junio C Hamano
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=20190119005202.GO840@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=asottile@umich.edu \
--cc=benpeart@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=peartben@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).