diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-03-08 16:28:34 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-15 13:56:43 +0900 |
commit | 1de16aecf51daf5794aa074f6dd133e088a12690 (patch) | |
tree | 08f462da8878ec63fe3cf9a5573da743e767abbf /t | |
parent | 7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87 (diff) | |
download | git-1de16aecf51daf5794aa074f6dd133e088a12690.tar.gz |
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>
Diffstat (limited to 't')
-rwxr-xr-x | t/t2400-worktree-add.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index 286bba35d8..c989dbe321 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -570,4 +570,9 @@ test_expect_success '"add" an existing locked but missing worktree' ' git worktree add --force --force --detach gnoo ' +test_expect_success FUNNYNAMES 'sanitize generated worktree name' ' + git worktree add --detach ". weird*..?.lock.lock" && + test -d .git/worktrees/---weird-.- +' + test_done |