aboutsummaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-01-09 18:32:29 -0800
committerJunio C Hamano <gitster@pobox.com>2026-01-09 18:32:29 -0800
commitec13dca8d0619dc1cfe4cee5801b32bc58792ae2 (patch)
tree4c84be76afefce235e96f2cf18b40262f46a65e8 /lockfile.c
parentc4a0c8845e2426375ad257b6c221a3a7d92ecfda (diff)
parentaa7b8864d841f16044b0d79fce5baaec1830b3e3 (diff)
downloadgit-ec13dca8d0619dc1cfe4cee5801b32bc58792ae2.tar.xz
Merge branch 'js/prep-symlink-windows' into js/symlink-windows
* js/prep-symlink-windows: trim_last_path_component(): avoid hard-coding the directory separator strbuf_readlink(): support link targets that exceed 2*PATH_MAX strbuf_readlink(): avoid calling `readlink()` twice in corner-cases init: do parse _all_ core.* settings early mingw: do resolve symlinks in `getcwd()` t7800: work around the MSYS path conversion on Windows t6423: introduce Windows-specific handling for symlinking to /dev/null t1305: skip symlink tests that do not apply to Windows t1006: accommodate for symlink support in MSYS2 t0600: fix incomplete prerequisite for a test case t0301: another fix for Windows compatibility t0001: handle `diff --no-index` gracefully mingw: special-case `open(symlink, O_CREAT | O_EXCL)` apply: symbolic links lack a "trustable executable bit" t9700: accommodate for Windows paths
Diffstat (limited to 'lockfile.c')
-rw-r--r--lockfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lockfile.c b/lockfile.c
index 1d5ed01682..67082a9caa 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -19,14 +19,14 @@ static void trim_last_path_component(struct strbuf *path)
int i = path->len;
/* back up past trailing slashes, if any */
- while (i && path->buf[i - 1] == '/')
+ while (i && is_dir_sep(path->buf[i - 1]))
i--;
/*
* then go backwards until a slash, or the beginning of the
* string
*/
- while (i && path->buf[i - 1] != '/')
+ while (i && !is_dir_sep(path->buf[i - 1]))
i--;
strbuf_setlen(path, i);