From 586a90bbd3140956ab4ce90c0f20ca6a1f07fb1d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 19 Jun 2015 21:00:46 +0000 Subject: [PATCH] mingw: keep trailing slashes for _wchdir() and readlink() This is needed so that `_wchdir()` can be used with drive root directories, e.g. C:\ (`_wchdir("C:")` fails to switch the directory to the root directory). This fixes https://github.com/msysgit/git/issues/359 (in Git for Windows 2.x only, though). Likewise, `readlink()`'s semantics require a trailing slash for symbolic links pointing to directories. Otherwise all checked out symbolic links pointing to directories would be marked as modified even directly after a fresh clone. This fixes https://github.com/git-for-windows/git/issues/210 Signed-off-by: Johannes Schindelin --- compat/mingw.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 41901b6242..2abf8c26a3 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -375,9 +375,6 @@ static wchar_t *normalize_ntpath(wchar_t *wbuf) for (i = 0; wbuf[i]; i++) if (wbuf[i] == '\\') wbuf[i] = '/'; - /* remove potential trailing slashes */ - while (i && wbuf[i - 1] == '/') - wbuf[--i] = 0; return wbuf; }