Re: [PATCH v3 6/6] worktree: add "unlock" command

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

 



On Wed, Jun 1, 2016 at 1:12 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:
>
>> +     if (is_main_worktree(wt))
>> +             die(_("'%s' is a main working directory"), av[0]);
>> +     if (!wt->lock_reason)
>> +             die(_("'%s' is not locked"), av[0]);
>
> Exactly the same comment about the lack of need for lock_reason
> field as 5/6 appiles here.  Also, as "lock" does not allow you to
> lock the primary tree, do you even need is_main_worktree() check?
>
> That is:
>
>         if (!worktree_is_locked(wt, &reason))
>                 die(_("'%s' is not locked), av[0]);
>
> should be sufficient, no?

It crossed my mind but I went for separate checks anyway because it
gives better explanation.

Assigning either lock or unlock status to main worktree does not work
well either. If you assume worktree is always unlocked, you still need
to check main worktree in lock, move and remove as all of them would
only proceed if it's an unlocked linked worktree. If you assume the
opposite, you need is_main_worktree() check here and "worktree list"
may print the confusing "locked" status on main worktree (I assume we
may add that later).
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]