Re: [PATCH v2 1/1] worktree add: sanitize worktree names

2019-02-22 Thread Duy Nguyen
On Fri, Feb 22, 2019 at 12:42 AM Ramsay Jones wrote: > > +static void sanitize_worktree_name(struct strbuf *name) > > +{ > > + char *orig_name = xstrdup(name->buf); > > + int i; > > + > > + /* > > + * All special chars replaced with dashes. See > > + * check_refname_component

Re: [PATCH v2 1/1] worktree add: sanitize worktree names

2019-02-21 Thread Ramsay Jones
On 21/02/2019 12:19, Nguyễn Thái Ngọc 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 could > be part of a refname and must

Re: [PATCH v2 1/1] worktree add: sanitize worktree names

2019-02-21 Thread Jeff King
On Thu, Feb 21, 2019 at 07:19:43PM +0700, Nguyễn Thái Ngọc Duy wrote: > +/* > + * worktree name is part of refname and has to pass > + * check_refname_component(). Remove unallowed characters to make it > + * valid. > + */ > +static void sanitize_worktree_name(struct strbuf *name) > +{ > + cha

[PATCH v2 1/1] 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