All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Barret Rennie <barret@brennie.ca>
Cc: "Johannes Sixt" <j6t@kdbg.org>,
	git@vger.kernel.org, "Eric Sunshine" <sunshine@sunshineco.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Michael Rappazzo" <rappazzo@gmail.com>
Subject: Re: [PATCH] builtin/worktree.c: add option for setting worktree name
Date: Mon, 27 Jun 2016 06:17:52 -0700	[thread overview]
Message-ID: <xmqqk2hadb3z.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <036C19B4-5941-43E4-AE2A-8782797D9523@brennie.ca> (Barret Rennie's message of "Sun, 26 Jun 2016 23:40:15 -0600")

Barret Rennie <barret@brennie.ca> writes:

>> For example, the "frotz" and "nitfol" repositories (i.e. where their
>> worktrees borrow their refs and object stores from) could have a
>> single configuration variable each, i.e.
>> 
>> 	(in $HOME/xyzzy/frotz/.git/config)
>>        [worktree] location = "~/*/frotz"
>> 
>> 	(in $HOME/xyzzy/libs/nitfol/.git/config)
>>        [worktree] location = "~/*/libs/nitfol"
>> 
>> and then the user could do in each of these two repositories
>> 
>> 	$ git -C ~/xyzzy/frotz worktree add --by-name xyzzy-1 topic-1
>> 	$ git -C ~/xyzzy/lib/nitfol worktree add --by-name xyzzy-1 topic-1
>> 
>> to get the desired layout instead.
>> 
>> The traditional way may be "create one HERE", and your patch tries
>> to tweak it to "create one at HERE with this NAME".  The above
>> attempts to remove the need for specifying the exact location every
>> time a new worktree is created, and instead let you specify the
>> systematic way in which you lay out your worktrees based on their
>> names.
>
> Are you proposing that `--by-name` creates a worktree in the current working
> directory or that the default behaviour of `git worktree add` is changed to
> to create the worktree in the current working directory when executed with
> only one argument (the branch)?

It is not a proposal but an illustration of what I meant by "hint".

What I am envisioning is that we may enhance the "worktree add"
subcommand to take two forms.  In addition to traditional

    $ git worktree add [opts] <path> [<branch>]

when worktree.location configuration is present, you could say

    $ git worktree add [opts] --by-name <name> [<branch>]

omitting <path> and instead giving <name>.  Use the <name> to
substitute the wildcard in the pattern given by worktree.location,
i.e. with the above example for "frotz",

    $ git worktree add --by-name xyzzy-1 topic-1

because the worktree.location configuration is set to "~/*/frotz",
that would act as if <path> was given as ~/xyzzy-1/frotz.  Name is
set to xyzzy-1, and the newly created worktree would initially check
out topic-1 branch.

  reply	other threads:[~2016-06-27 13:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25  5:15 [PATCH] builtin/worktree.c: add option for setting worktree name Barret Rennie
2016-06-25  6:17 ` Junio C Hamano
2016-06-25  6:28   ` Barret Rennie
2016-06-25  7:15 ` Johannes Sixt
2016-06-25  7:29   ` Barret Rennie
2016-06-25  7:29   ` Barret Rennie
2016-06-25 19:45     ` Junio C Hamano
2016-06-25 20:19       ` Barret Rennie
2016-06-26 18:15       ` Junio C Hamano
2016-06-27  5:40         ` Barret Rennie
2016-06-27 13:17           ` Junio C Hamano [this message]
2016-06-26 23:00       ` Eric Sunshine
2016-06-27  5:52         ` Barret Rennie
2016-06-27 23:11           ` Eric Sunshine
2016-06-29  4:45             ` Barret Rennie
2016-06-25  7:32   ` Barret Rennie

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=xmqqk2hadb3z.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=barret@brennie.ca \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=pclouds@gmail.com \
    --cc=rappazzo@gmail.com \
    --cc=sunshine@sunshineco.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.