git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] worktree: new place for "git prune --worktrees"

From
Duy Nguyen <pclouds@gmail.com>
Date
Jul 1, 2015, 10:38 UTC
Message-ID
<CACsJy8ASdbmHuJn_og_jHxHn_h0gZ-30ieD=vwMJ6O-j=1hGGQ@mail.gmail.com>
In-Reply-To
<xmqqh9pqcx1q.fsf@gitster.dls.corp.google.com>
On Mon, Jun 29, 2015 at 11:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> 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.

I was about to prepare v2, but the only change in the end was removing this blank line, not worth another round.

Show 25 quoted lines
>> 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.

And because "git worktree add" is coming, I guess it's ok to stick to mainporcelain here..

Show 12 quoted lines
>> 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?
Yes.
-- 
Duy
Previous: Junio C Hamano
Message 3 of 3 in “worktree: new place for "git prune --worktrees"”
  1. worktree: new place for "git prune --worktrees"Nguyễn Thái Ngọc Duy, Jun 29, 2015
  2. Junio C HamanoJun 29, 2015
  3. Duy NguyenJul 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.