Re: [PATCH v2] checkout: teach --worktree

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

 



Hi Denton

On 23/06/2020 16:55, Denton Liu wrote:
> Hi Phillip,
> 
> Sorry for the late reply.
> 
> On Tue, Jun 16, 2020 at 05:01:53PM +0100, Phillip Wood wrote:
>> I'm afraid I'm not sure that adding another option to `git checkout` is a
>> good idea. The behavior of `git checkout` is already complicated enough
>> which is why we ended up with switch and restore separating out branch
>> switching from file updating.
> 
> I think that since this option clearly applies only for a
> restore-type action and there are checks in place to ensure that
> the user is not attempting to use it for a switch-type action, it
> doesn't introduce much more complexity than the `git restore --worktree`
> option does.

It introduces more complexity to checkout by existing. The point I was
trying to make was that checkout is complicated to use and adding more
features makes that problem worse. As to being obvious that it applies
to a restore-type action, when I first saw the patch subject line my
immediate thought was that it was going to be doing something with
worktrees.

I am worried that people will think 'checkout --worktree' is the same as
'restore --worktree' but it isn't it's the same as 'restore --overlay
--worktree'. Having subtle differences like this between commands is
confusing for users and wastes our time answering queries about the
difference on the mailing list. It is not possible to make 'checkout
--worktree' imply --no-overlay as that would be inconsistent with
'checkout <pathspec>'

> 
>> Given `git restore` provides a way to update the worktree without touching
>> the index I'm not convinced we should be further complicating `git checkout`
>> especially as it defaults to --overlay unless -p is given which is confusing
>> in itself.
> 
> I don't think it'll hurt to provide more than one way of doing it.

I disagree, it is confusing to users if they see one person saying "use
checkout" and another "use restore". They will wonder if there is a
difference between them and which one is better. It's to be expected
that there will be some overlap in functionality between commands as git
grows and adds new commands but in this case we're adding functionality
that already exists. There was a lot of thought and discussion put into
designing and implementing 'switch' and 'restore' to make more
predictable and easier for users to understand, adding more options to
'checkout' under cuts that by muddying the waters on which command
should be used.

> As a
> pretty long-time user of git, I've been having trouble picking up the
> switch/restore commands in favour of good ol' checkout due to muscle
> memory. I agree that I should try and switch over to these new commands
> but old habits die hard and I think it would be much easier to just
> provide this option to checkout.

While I have sympathy with that (I still use checkout myself a lot of
the time) it's hard to argue you have a muscle memory for an option that
does not exist!

Best Wishes

Phillip

> Thanks,
> 
> Denton
> 




[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