Re: [PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Jeff King
On Thu, Feb 21, 2019 at 06:52:05PM +0700, Duy Nguyen wrote: > > the postfix internally, but why can't it be okay with "name.lock.lock") > > Uh oh I miss this case. I only delete ".lock" once, "name.lock" would > still be rejected. Thanks for noticing. Another tricky case is "refs/heads/foo.lock/

Re: [PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Duy Nguyen
On Thu, Feb 21, 2019 at 6:44 PM Konstantin Kharlamov wrote: > >> > + > >> > + /* last resort, should never ever happen in practice */ > >> > + if (name->len == 0) > >> > + strbuf_addstr(name, "worktree"); > >> > >> I assume this means a user have passed a zero-sized worktr

Re: [PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Konstantin Kharlamov
On Чт, Feb 21, 2019 at 2:38 PM, Duy Nguyen wrote: On Thu, Feb 21, 2019 at 6:28 PM Konstantin Kharlamov wrote: On Чт, Feb 21, 2019 at 2:00 PM, =?UTF-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy wrote: > Worktree names are based on $(basename $GIT_WORK_TREE). They aren't > significant unt

Re: [PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Duy Nguyen
On Thu, Feb 21, 2019 at 6:28 PM Konstantin Kharlamov wrote: > > > > On Чт, Feb 21, 2019 at 2:00 PM, > =?UTF-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy wrote: > > Worktree names are based on $(basename $GIT_WORK_TREE). They aren't > > significant until 3a3b9d8cde (refs: new ref types to make per-workt

Re: [PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Konstantin Kharlamov
On Чт, Feb 21, 2019 at 2:00 PM, =?UTF-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy wrote: Worktree names are based on $(basename $GIT_WORK_TREE). They aren't significant until 3a3b9d8cde (refs: new ref types to make per-worktree refs visible to all worktrees - 2018-10-21), where worktree name coul

[PATCH] worktree add: sanitize worktree names

2019-02-21 Thread Nguyễn Thái Ngọc Duy
Worktree names are based on $(basename $GIT_WORK_TREE). They aren't significant until 3a3b9d8cde (refs: new ref types to make per-worktree refs visible to all worktrees - 2018-10-21), where worktree name could be part of a refname and must follow refname rules. Update 'worktree add' code to remove