Skip to content

worktree add: sanitize worktree names

Nguyễn Thái Ngọc Duy git 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest1 patch 9 repliesIn review
  2. v42 patches 2 repliesSuperseded
  3. v31 patch 7 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v21 patch3 repliesSuperseded
v11 patch5 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1worktree add: sanitize worktree namesbuiltin/worktree.c refs.c refs.h +1 more+104 -209 replies

Reviews trailers per patch

The patch has no Reviewed-by or Acked-by.

PatchJeff King
1/1Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/1] worktree add: sanitize worktree names

v5 is basically Jeff's version from one of the replies in v4, where check_refname_component is enhanced to optionally sanitize.

I was reluctant to go this way because it makes check_refname_component more complex (turns out still manageable) and burns worktree rules in it. But there may never be the second sanitization user, we deal with it when it comes.

As said, refs.c is pretty much Jeff's except two major changes:

- handle foo.lock.lock correctly by stripping .lock repeatedly

- sanitize refname _components_ instead of full refs. I could construct worktrees/<name> and pass to Jeff's sanitize_refname. But then I need to strip worktrees/ after that.

I took credits so that bugs come to me first (then I'll blame him anyway while doing some evil laughs)

Nguyễn Thái Ngọc Duy (1):
worktree add: sanitize worktree names

 builtin/worktree.c      |  10 +++-
 refs.c                  | 103 ++++++++++++++++++++++++++++++++--------
 refs.h                  |   6 +++
 t/t2400-worktree-add.sh |   5 ++
 4 files changed, 104 insertions(+), 20 deletions(-)
Signature · 1 line
2.21.0.rc1.337.gdf7f8d0522