]> git.ipfire.org Git - thirdparty/git.git/commit - refs.h
worktree add: sanitize worktree names
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 8 Mar 2019 09:28:34 +0000 (16:28 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 May 2019 04:56:43 +0000 (13:56 +0900)
commit1de16aecf51daf5794aa074f6dd133e088a12690
tree08f462da8878ec63fe3cf9a5573da743e767abbf
parent7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87
worktree add: sanitize worktree names

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 special characters to follow
these rules. In the future the user will be able to specify the
worktree name by themselves if they're not happy with this dumb
character substitution.

Reported-by: Konstantin Kharlamov <hi-angel@yandex.ru>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
refs.c
refs.h
t/t2400-worktree-add.sh