aboutsummaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-01-21 08:29:00 -0800
committerJunio C Hamano <gitster@pobox.com>2026-01-21 08:29:00 -0800
commit39d66ddffd2b1dda275a6dd61df3eebac35fcf8a (patch)
tree3b18ec048f1154499995d5bf91b67ff9213198c8 /lockfile.c
parentbc5cbbe24650f4234ed4ed2c21c58058f96dfcac (diff)
parentaa7b8864d841f16044b0d79fce5baaec1830b3e3 (diff)
downloadgit-39d66ddffd2b1dda275a6dd61df3eebac35fcf8a.tar.xz
Merge branch 'js/prep-symlink-windows'
Further preparation to upstream symbolic link support on 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()`
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);