git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] worktree: new place for "git prune --worktrees"
Date: Mon, 29 Jun 2015 09:13:37 -0700	[thread overview]
Message-ID: <xmqqh9pqcx1q.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1435582278-31158-1-git-send-email-pclouds@gmail.com> ("Nguyễn	Thái Ngọc Duy"'s message of "Mon, 29 Jun 2015 19:51:18 +0700")

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> Commit 23af91d (prune: strategies for linked checkouts - 2014-11-30)
> adds "--worktrees" to "git prune" without realizing that "git prune" is
> for object database only. This patch moves the same functionality to a
> new command "git worktree".
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  In future I probably move the big block of text in git-checkout.txt to
>  git-worktree.txt and add "git worktree list". But let's start with
>  something small and simple before "git prune --worktrees" is shipped
>  out.

Thanks.  I notice that after applying this, builtin/prune.c does not
revert to the original before 23af91d.  It stops including "dir.h"
and it adds an extra blank line.  We've been including a header that
is not necessary even in v2.4.0, it seems.  We used to walk
$GIT_DIR/objects ourselves to find loose object files and "dir.h"
was needed for is_dot_or_dotdot(); for_each_loose_file_in_objdir()
is what we use these days to hide the implementation details these
days; 27e1e22 forgot to remove the inclusion when it did this.

The C code part is mostly just \C-x \C-v and I found nothing
questionable.

> diff --git a/command-list.txt b/command-list.txt
> index b17c011..2a94137 100644
> --- a/command-list.txt
> +++ b/command-list.txt
> @@ -148,4 +148,5 @@ git-verify-pack                         plumbinginterrogators
>  git-verify-tag                          ancillaryinterrogators
>  gitweb                                  ancillaryinterrogators
>  git-whatchanged                         ancillaryinterrogators
> +git-worktree                            mainporcelain

I doubt that a helper that is primarily spawned from "gc" as its
implementation detail is more mainporcelain than "git config" is:

   git-config                              ancillarymanipulators

I also wonder if "git worktree" command should have a mode that
works in a way similar to how new-workdir (in contrib/workdir) does,
instead of an option "checkout --to" that looks just out of place as
"worktree prune" was out of place in "prune".  The feature is doing
a lot more than what "checkout" normally does (somewhere in between
"checkout" and "clone", I would say), and it may be cleaner to use
an independent command "git worktree" to manage a separate worktree.

And when that happens, the command should definitely be classified
as a mainporcelain.

> diff --git a/git.c b/git.c
> index 44374b1..fa77bc9 100644
> --- a/git.c
> +++ b/git.c
> @@ -483,6 +483,7 @@ static struct cmd_struct commands[] = {
>  	{ "verify-tag", cmd_verify_tag, RUN_SETUP },
>  	{ "version", cmd_version },
>  	{ "whatchanged", cmd_whatchanged, RUN_SETUP },
> +	{ "worktree", cmd_worktree, RUN_SETUP },

We do not NEED_WORK_TREE because we can create a new worktree
off of a bare repository?

  reply	other threads:[~2015-06-29 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 12:51 [PATCH] worktree: new place for "git prune --worktrees" Nguyễn Thái Ngọc Duy
2015-06-29 16:13 ` Junio C Hamano [this message]
2015-07-01 10:38   ` Duy Nguyen

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=xmqqh9pqcx1q.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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.
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).