diff options
| author | René Scharfe <l.s.r@web.de> | 2026-08-25 20:03:49 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-25 12:35:30 -0700 |
| commit | a6de316efde124a132d38e50c6407477df47f9cd (patch) | |
| tree | 080c3535e5603075f0fde9b33074f2129923993b /contrib/persistent-https | |
| parent | 382f88157754097baad9fb0b45513d9e9135a63e (diff) | |
worktree add: trim slashes when deriving branch name from path
worktree_basename() sets `n` to the length of `path` without trailing
path separators, not to the length of the basename. This matters when
deriving a branch name from a path with more than one component. E.g.:
path: /new/worktree/
s: ^
n: |-----------|
So here xstrndup(s, n) copies up to 13 characters from "worktree/",
effectively to the end of the string, including the trailing dash.
Path separators are not allowed at the end of branch names, so strip
them off by calculating the basename length and extracting just that
part.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
