summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2016-04-02 19:03:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-05 01:03:02 (GMT)
commit8e9b20804a9900d4560e9ace4bb8c5d048a2097e (patch)
tree689892e0927299f6fced342cf8098931c3d91742 /abspath.c
parent8257d3b458f0b64516f4aee66a9b2b2df30744e1 (diff)
downloadgit-8e9b20804a9900d4560e9ace4bb8c5d048a2097e.zip
git-8e9b20804a9900d4560e9ace4bb8c5d048a2097e.tar.gz
git-8e9b20804a9900d4560e9ace4bb8c5d048a2097e.tar.bz2
Windows: shorten code by re-using convert_slashes()
Make a few more spots more readable by using the recently introduced, Windows-specific helper. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/abspath.c b/abspath.c
index 5edb4e7..2825de8 100644
--- a/abspath.c
+++ b/abspath.c
@@ -167,7 +167,6 @@ const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
strbuf_add(&path, pfx, pfx_len);
strbuf_addstr(&path, arg);
#else
- char *p;
/* don't add prefix to absolute paths, but still replace '\' by '/' */
strbuf_reset(&path);
if (is_absolute_path(arg))
@@ -175,9 +174,7 @@ const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
else if (pfx_len)
strbuf_add(&path, pfx, pfx_len);
strbuf_addstr(&path, arg);
- for (p = path.buf + pfx_len; *p; p++)
- if (*p == '\\')
- *p = '/';
+ convert_slashes(path.buf + pfx_len);
#endif
return path.buf;
}