git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: git@vger.kernel.org
Subject: [PATCH 0/4] worktree add: worktree_basename() fixes
Date: Tue, 25 Aug 2026 20:03:46 +0200	[thread overview]
Message-ID: <20260825180350.2099-1-l.s.r@web.de> (raw)

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/pull.2187.git.1784978348.gitgitgadget@gmail.com/

-- 
2.55.0


             reply	other threads:[~2026-08-25 18:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 18:03 René Scharfe [this message]
2026-08-25 18:03 ` [PATCH 1/4] worktree add: don't read out of bounds in worktree_basename() René Scharfe
2026-08-25 18:03 ` [PATCH 2/4] worktree add: reject separator-only path René Scharfe
2026-08-25 18:03 ` [PATCH 3/4] worktree add: trim slashes when deriving branch name from path René Scharfe
2026-08-25 19:47   ` Junio C Hamano
2026-08-25 18:03 ` [PATCH 4/4] worktree add: let worktree_basename() return string copy René Scharfe
2026-08-25 20:04   ` Junio C Hamano
2026-08-26  4:37     ` René Scharfe
2026-08-26 14:35       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260825180350.2099-1-l.s.r@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).