git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Ray Zhang <zhanglei002@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2] worktree: add: introduce --checkout option
Date: Thu, 24 Mar 2016 21:18:41 -0400	[thread overview]
Message-ID: <CAPig+cQGTcX+1nKM-zzGrJXgKsa6aaZxAHwD=z1M8-s+ugJRFg@mail.gmail.com> (raw)
In-Reply-To: <01020153a73bbb70-11a8482f-1a90-49e4-a56c-b311e12a85a2-000000@eu-west-1.amazonses.com>

On Thu, Mar 24, 2016 at 2:07 AM, Ray Zhang <zhanglei002@gmail.com> wrote:
> By adding this option which defaults to true, we can use the
> corresponding --no-checkout to make some customizations before
> the checkout, like sparse checkout, etc.

This version of the patch looks better. Thanks. A few comments below...

> Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
> ---

Here, below the "---" line is a good place to explain to reviewers
what changed since the previous version of the patch. It's also
helpful to provide a link to the previous version, like this[1].

[1]: http://thread.gmane.org/gmane.comp.version-control.git/289659

> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
> @@ -87,6 +87,10 @@ OPTIONS
>         With `add`, detach HEAD in the new working tree. See "DETACHED HEAD"
>         in linkgit:git-checkout[1].
>
> +--checkout::

We can make it more clear that this is a boolean option by formatting
it either like this:

    --[no-]checkout::

or this:

    --checkout::
    --no-checkout::

I don't have a strong preference, and existing documentation uses either form.

> +       Default option with `add`, populate the new working tree. Use
> +       `--no-checkout` to skip the checkout.

It's subjective, but "Default option with `add`" doesn't quite convey
to me that this is the default behavior of "add". Also, readers would
likely benefit from some explanation of why they might ever want to
use this option. Perhaps it could be rewritten something like this:

    By default, `add` checks out HEAD, however, `--no-checkout` can
    be used to suppress checkout in order to make customizations,
    such as configuring sparse-checkout (see ...).

> diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
> @@ -213,4 +213,9 @@ test_expect_success 'local clone from linked checkout' '
>         ( cd here-clone && git fsck )
>  '
>
> +test_expect_success '"add" worktree without a checkout' '
> +       git worktree add --no-checkout -b swamp swamp &&
> +       ( cd swamp && git reset --hard && git fsck)

To match the style of the test immediately above this one, you'd want
a space before the closing ')'.

However, I'm not convinced that reset+fsck is is really telling you
much, as fsck is about checking the object database (which was already
the subject of earlier tests in the script) and doesn't say anything
about the working directory which is the point of --no-checkout. Much
more interesting would be to verify that no files were checked out.
There are many ways to do so; here's one:

    git worktree add --no-checkout -b swamp swamp &&
    ls swamp >actual &&
    test_line_count = 0 actual

> +'

Finally, it wouldn't hurt to also add a test to verify that --checkout
works as expected (because the tests should check expected *behavior*,
not *implementation*).

  parent reply	other threads:[~2016-03-25  1:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 15:08 [PATCH] add option -n (--no-checkout) to git-worktree add Ray Zhang
2016-03-23 15:49 ` Eric Sunshine
2016-03-23 15:51 ` Junio C Hamano
2016-03-23 17:43   ` Eric Sunshine
2016-03-24  6:07 ` [PATCH v2] worktree: add: introduce --checkout option Ray Zhang
2016-03-24  9:16   ` Duy Nguyen
2016-03-24  9:52     ` Zhang Lei
2016-03-25  1:22       ` Eric Sunshine
2016-03-25  1:29         ` Eric Sunshine
2016-03-25  1:49           ` Duy Nguyen
2016-03-25 11:31             ` Zhang Lei
2016-03-25 11:41               ` Duy Nguyen
2016-03-25 12:06                 ` Zhang Lei
2016-03-25 12:15                   ` Duy Nguyen
2016-03-25 13:02                 ` Mike Rappazzo
2016-03-25  1:18   ` Eric Sunshine [this message]
2016-03-25 11:25   ` [PATCH v3] " Ray Zhang
2016-03-27 19:49     ` Eric Sunshine
2016-03-28 10:52     ` [PATCH v4] " Ray Zhang
2016-03-28 17:40       ` Junio C Hamano
2016-03-29 10:11       ` [PATCH v5] " Ray Zhang
2016-03-29 10:54         ` John Keeping
2016-03-29 18:04           ` Eric Sunshine
2016-03-29 20:15             ` John Keeping
2016-03-29 20:28               ` Junio C Hamano
2016-03-29 19:20         ` Eric Sunshine
2016-03-30  3:11           ` Zhang Lei
2016-03-30 17:59             ` Eric Sunshine
     [not found]       ` <CAPig+cSkE-xoaXnXHZHB4xz=ehCR973PaKbZJRyiTvHWn0AyoA@mail.gmail.com>
2016-03-29 18:43         ` [PATCH v4] " Eric Sunshine

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAPig+cQGTcX+1nKM-zzGrJXgKsa6aaZxAHwD=z1M8-s+ugJRFg@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=zhanglei002@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).