config --show-origin: report paths with forward slashes
On Windows, the backslash is the native directory separator, but all supported Windows versions also accept the forward slash in most circumstances. Our tests expect forward slashes. Relative paths are generated by Git using forward slashes. So let's try to be consistent and use forward slashes in the $HOME part of the paths reported by `git config --show-origin`, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Mar 23, 2016 at 11:55 UTC
5ca6b7bb47bddacac61e837d7692e1e8f5b24188
2 files changed
+9
compat/mingw.h
+6
@@ -396,6 +396,12 @@ static inline char *mingw_find_last_dir_sep(const char *path)
396
ret = (char *)path;
397
return ret;
398
}
399
+static inline void convert_slashes(char *path)
400
+{
401
+ for (; *path; path++)
402
+ if (*path == '\\')
403
+ *path = '/';
404
+}
405
#define find_last_dir_sep mingw_find_last_dir_sep
406
int mingw_offset_1st_component(const char *path);
407
#define offset_1st_component mingw_offset_1st_component
path.c
+3
@@ -584,6 +584,9 @@ char *expand_user_path(const char *path)
584
if (!home)
585
goto return_null;
586
strbuf_addstr(&user_path, home);
587
+#ifdef GIT_WINDOWS_NATIVE
588
+ convert_slashes(user_path.buf);
589
+#endif
590
} else {
591
struct passwd *pw = getpw_str(username, username_len);
592
if (!pw)