> <
https://lh3.googleusercontent.com/-GdI10yoVYb4/VtHyt42TpzI/AAAAAAAAAjg/t-Iz0kqXP3I/s1600/Screen%2BShot%2B2016-02-27%2Bat%2B19.55.05.png>
>
>
> As you can see the paths look funny ("\\" and sometimes "/"). Is there
> anything we could do about this (I have not much experience with Git for
> Windows)?
Path given by Windows use the backward slashes while Git code always
generates forward slashes (even though it accepts both as path
separator). Something like this may work, the idea is rewrite output
paths. It's like translating strings to different languages, if you
consider Windows paths a "language".
I will not follow this up because I don't use Windows (I changed
#ifdef to #ifndef to test it). If you are interested in making paths
on Windows look better, I suggest you check with both GFW and Git
community on the approach before start making more changes.
-- 8< --
diff --git a/builtin/config.c b/builtin/config.c
index ca9f834..694c555 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -94,6 +94,34 @@ static void check_argc(int argc, int min, int max) {
usage_with_options(builtin_config_usage, builtin_config_options);
}
+#ifdef GIT_WINDOWS_NATIVE
+static const char *P_(const char *p)
+{
+ static struct strbuf buf[4] = {
+ STRBUF_INIT, STRBUF_INIT, STRBUF_INIT, STRBUF_INIT
+ };
+ static int idx;
+ struct strbuf *sb;
+ int i;
+
+ if (!strchr(p, '/'))
+ return p;
+ sb = buf + idx;
+ idx = (idx + 1) % 4;
+ strbuf_reset(sb);
+ strbuf_addstr(sb, p);
+ for (i = 0; i < sb->len; i++)
+ if (sb->buf[i] == '/')
+ sb->buf[i] = '\\';
+ return sb->buf;
+}
+#else
+static inline const char *P_(const char *p)
+{
+ return p;
+}
+#endif
+
static void show_config_origin(struct strbuf *buf)
{
const char term = end_null ? '\0' : '\t';
@@ -101,9 +129,9 @@ static void show_config_origin(struct strbuf *buf)
strbuf_addstr(buf, current_config_origin_type());
strbuf_addch(buf, ':');
if (end_null)
- strbuf_addstr(buf, current_config_name());
+ strbuf_addstr(buf, P_(current_config_name()));
else
- quote_c_style(current_config_name(), buf, NULL, 0);
+ quote_c_style(P_(current_config_name()), buf, NULL, 0);
strbuf_addch(buf, term);
}
-- 8< --