Re: [PATCH v1 2/2] worktree: make add dwim

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

 



On Wed, Nov 15, 2017 at 3:50 AM, Thomas Gummerer <t.gummerer@xxxxxxxxx> wrote:
> On 11/14, Eric Sunshine wrote:
>> git worktree add ../topic
>> [...]
>> The desired new DWIMing would change the second bullet point to:
>>
>> * If no local branch named "topic" exists, DWIM it from "origin/topic"
>> if possible, else create a new local branch named "topic".
>>
>> But that's a behavior change since, with the existing implementation,
>> a newly created local "topic" has no relation to, and does not track,
>> any origin/topic branch. The proposed --guess option is to avoid users
>> being hit by this backward incompatibility, however, one could also
>> view the proposed DWIMing as some sort of bug fix since, at least
>> some, users would expect the DWIMing since it already takes place
>> elsewhere.
>
> I'm not sure we can call it a bug fix anymore, since as Junio pointed
> out the current behaviour of creating a new branch at HEAD is
> documented in the man page.
>
> However git-worktree is also still marked as experimental in the man
> page, so we could allow ourselves to be a little bit more lax when it
> comes to backwards compatibility, especially because it is easy to
> take corrective action after the new DWIMing happened.

Yep, my leaning toward making this new DWIMing default (without a
--guess or --track option) also is based in part on git-worktree still
being marked "experimental".

>> So, at least two options exist:
>>
>> * Just make the new DWIMing the default behavior, accepting that it
>> might bite a few people. Fallout can be mitigated somewhat by
>> prominently announcing that the DWIMing took place, in which case the
>> user can take corrective action (say, by choosing a different worktree
>> name); nothing is lost and no damage done since this is happening only
>> at worktree creation time.
>>
>> * Add a new option to enable DWIMing; perhaps name it -t/--track,
>> which is familiar terminology and still gives you a relatively short
>> and sweet "git worktree add -t ../topic".
>>
>> Given the mentioned mitigation factor and that some/many users likely
>> would expect it to DWIM "origin/topic -> topic" anyhow, I'd lean in
>> favor of the first option (but perhaps I'm too daring with other
>> people's workflows).
>
> Yeah, I'm leaning towards the first option as well, but I'm clearly
> biased as that's how I'd like it to behave, and others might want the
> other behaviour.  Unfortunately I don't know many worktree users, so I
> can't tell what the general consensus on this would be.

Aside from the mentioned mitigation factor, which somewhat eases my
worries about backward incompatibility, one genuine concern is
breaking existing scripts. At the very least, if the new DWIM becomes
default, there might need to be some escape hatch for scripts to opt
out of it.

> I guess the second option would be the safer one, and we can still
> switch that to be the default at some point if we wish to do so
> later.

The longer you wait, the less likely you'll have the chance since
git-worktree will (presumably) gain more users and be used in more
scripts as time passes. So, if the new DWIMing is to become the
default, better to do so earlier rather than later.

> tl;dr I have no idea which of the options would be better :)

I'm probably too cavalier and shortsighted (at least on this topic) to
make a well-informed decision about it. Junio probably has a better
feeling about whether such a change of behavior makes sense at this
late date, and, of course, it's his decision whether to accept such a
change into his tree.



[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