Thread (4 messages) flat view 4 messages, 3 authors, 2020-01-27

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

From: Eric Sunshine <hidden>
Date: 2020-01-27 16:28:34

On Sat, Jan 25, 2020 at 12:37 PM Pratyush Yadav [off-list ref] 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 <redacted>
---
For more context:
https://lore.kernel.org/git/CAPig+cQmqKiYWDWFH5eK2S6XPOi2t2+8Oas8yZa8R=bKLym3wQ@mail.gmail.com/ (local)

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@mail.gmail.com/ (local)
[2]: https://lore.kernel.org/git/CAPig+cTva89t8Zco-Ke0oD5xDZF_uuGH-gSkLXE2r31NtSE8nw@mail.gmail.com/ (local)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help