Skip to content

worktree add: worktree_basename() fixes

René Scharfe git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4worktree add: don't read out of bounds in worktree_basename()builtin/worktree.c+3 -50 replies
2/4worktree add: reject separator-only pathbuiltin/worktree.c t/t2400-worktree-add.sh+6 -00 replies
3/4worktree add: trim slashes when deriving branch name from pathbuiltin/worktree.c t/t2400-worktree-add.sh+15 -21 reply
4/4worktree add: let worktree_basename() return string copybuiltin/worktree.c+10 -154 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchMatthias Aßhauer
1/4Original-patch-by
2/4Original-patch-by
3/4
4/4

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

Read the v1 thread

Cover letter [PATCH 0/4] worktree add: worktree_basename() fixes

Here's my take on solving the issues addressed by [1]. I'd prefer a reroll of that series, but in case it won't come we can use this one.

The first fix is the most important one, avoiding potential data loss. The third one starts to accept paths with trailing path separators, the fourth one simplifies the code.

worktree add: don't read out of bounds in worktree_basename() worktree add: reject separator-only path
worktree add: trim slashes when deriving branch name from path worktree add: let worktree_basename() return string copy

 builtin/worktree.c      | 33 ++++++++++++++-------------------
 t/t2400-worktree-add.sh | 17 +++++++++++++++++
 2 files changed, 31 insertions(+), 19 deletions(-)

[1] https://lore.kernel.org/git/[email protected]/

Signature · 1 line
2.55.0