Re: [PATCH] worktree: add shorthand '-d' for detach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 25, 2020 at 12:37 PM Pratyush Yadav <me@xxxxxxxxxxxxxxxxx> wrote:
> [...]
> An alternative to this is to create a detached worktree which doesn't
> lead to a branch being created. This can be done by the '--detach'
> option. Add the shorthand to make it more convenient to use it.
>
> Signed-off-by: Pratyush Yadav <me@xxxxxxxxxxxxxxxxx>
> ---
> For more context:
> https://lore.kernel.org/git/CAPig+cQmqKiYWDWFH5eK2S6XPOi2t2+8Oas8yZa8R=bKLym3wQ@xxxxxxxxxxxxxx/
>
> I'll send a patch to add the config option as a follow up some time
> later.

Although the suggestion of a config option came from me (in [1] and
extended in [2]), I had second thoughts about it very shortly after
sending [2], and can't say that I am particularly in favor of it.
There are at least a couple reasons why I have taken this view.

First, the idea suggested in [2] can be seen as a specialized
mechanism which is perhaps already handled better by the more
generalized mechanism provided by Git aliases. That is, someone can
achieve the same goal of conveniently providing a particular set of
command-line options by simply defining a Git alias; for instance,
"git wttemp" might expand to "git worktree add --detach". We don't
need to be re-inventing the wheel (poorly).

Second, the only real case which has arisen thus far is that of
throwaway (detached) worktrees, and the added '-d' alias for
'--detach' makes that about as simple as possible to achieve without
requiring any extra machinery. If, at some point down the road, other
real-world cases arise in which it would be convenient to tweak
worktree creation in some mechanized fashion, perhaps then it would
make sense to implement all the extra code to support such a config
option, but right now it seems overkill.

[1]: https://lore.kernel.org/git/CAPig+cQmqKiYWDWFH5eK2S6XPOi2t2+8Oas8yZa8R=bKLym3wQ@xxxxxxxxxxxxxx/
[2]: https://lore.kernel.org/git/CAPig+cTva89t8Zco-Ke0oD5xDZF_uuGH-gSkLXE2r31NtSE8nw@xxxxxxxxxxxxxx/



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux