submodule: ignore trailing slash on superproject URL
[gitweb.git] / path.c
diff --git a/path.c b/path.c
index 3cd155e27dddee6774d48522945c0615f6207d8c..969b494d72dff1439150e7bb945339be07c4d475 100644 (file)
--- a/path.c
+++ b/path.c
@@ -584,6 +584,9 @@ char *expand_user_path(const char *path)
                        if (!home)
                                goto return_null;
                        strbuf_addstr(&user_path, home);
+#ifdef GIT_WINDOWS_NATIVE
+                       convert_slashes(user_path.buf);
+#endif
                } else {
                        struct passwd *pw = getpw_str(username, username_len);
                        if (!pw)
@@ -782,13 +785,10 @@ const char *relative_path(const char *in, const char *prefix,
        else if (!prefix_len)
                return in;
 
-       if (have_same_root(in, prefix)) {
+       if (have_same_root(in, prefix))
                /* bypass dos_drive, for "c:" is identical to "C:" */
-               if (has_dos_drive_prefix(in)) {
-                       i = 2;
-                       j = 2;
-               }
-       } else {
+               i = j = has_dos_drive_prefix(in);
+       else {
                return in;
        }
 
@@ -943,11 +943,10 @@ const char *remove_leading_path(const char *in, const char *prefix)
 int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
 {
        char *dst0;
+       int i;
 
-       if (has_dos_drive_prefix(src)) {
+       for (i = has_dos_drive_prefix(src); i > 0; i--)
                *dst++ = *src++;
-               *dst++ = *src++;
-       }
        dst0 = dst;
 
        if (is_dir_sep(*src)) {