All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/2] checkout: add test to demonstrate regression with checkout -b on initial commit
Date: Fri, 18 Jan 2019 20:23:31 +0100	[thread overview]
Message-ID: <20190118192331.GN840@szeder.dev> (raw)
In-Reply-To: <20190118185558.17688-2-peartben@gmail.com>

On Fri, Jan 18, 2019 at 01:55:57PM -0500, Ben Peart wrote:
> From: Ben Peart <benpeart@microsoft.com>
> 
> Commit fa655d8411 checkout: optimize "git checkout -b <new_branch>" introduced

Style nit: fa655d8411 (checkout: optimize "git checkout -b
<new_branch>", 2018-08-16)

Furthermore, please wrap the commit message at a width of around 70 or
so chars.

> an unintentional change in behavior for 'checkout -b' after doing a
> 'clone --no-checkout'.  Add a test to demonstrate the changed behavior to be
> used in a later patch to verify the fix.
> 
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
>  t/t2018-checkout-branch.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
> index 2131fb2a56..35999b3adb 100755
> --- a/t/t2018-checkout-branch.sh
> +++ b/t/t2018-checkout-branch.sh
> @@ -198,4 +198,15 @@ test_expect_success 'checkout -B to the current branch works' '
>  	test_dirty_mergeable
>  '
>  
> +test_expect_success 'checkout -b after clone --no-checkout does a checkout of HEAD' '

As this test is supposed to demonstrate a regression, this should be
test_expect_failure (to be flipped to test_expect_success in the next
patch fixing the regression).

> +	git init src &&
> +	echo hi > src/a &&

Style nit: no space between redirection and filename, but...

> +	git -C src add . &&
> +	git -C src commit -m "initial commit" &&

The above three lines could be replaced by a single

  test_commit -C src a

command.

> +	rev="$(git -C src rev-parse HEAD)" &&
> +	git clone --no-checkout src dest &&
> +	git -C dest checkout "$rev" -b branch &&
> +	test_must_fail test -f dest/a

And here the test should expect the file to be there even when
demonstrating the regression.

Please use the 'test_path_is_file' helper instead of 'test -f', as it
gives a useful error on failure.

> +'
> +
>  test_done
> -- 
> 2.19.1.gvfs.1.16.g9d1374d
> 

  reply	other threads:[~2019-01-18 19:23 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 [this message]
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
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=20190118192331.GN840@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 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.