{"thread":{"id":"34924","subject":"[PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw","startedAt":"2013-09-13T05:08:11Z","lastAt":"2013-09-17T16:19:01Z","messageCount":8,"participants":["Jiang Xin","Junio C Hamano","Torsten Bögershausen"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"227609","messageId":"cover.1379048276.git.worldhello.net@gmail.com","threadId":"34924","inReplyTo":"xmqq38pczjw6.fsf@gitster.dls.corp.google.com","subject":"[PATCH v2 0/3] fixes for relative_path","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-09-13T05:08:11Z","receivedAt":"2013-09-13T05:08:11Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Updates since v1:\n\n* New patch 1/3 on t0060, which use umambigous leading path (/foo).\n* Call tolower instead of strncasecmp in patch 2/3.\n* Rename simple_relative_path to remove_leading_path in patch 3/3.\n\nJiang Xin (3):\n  test: use unambigous leading path (/foo) for mingw\n  relative_path should honor dos_drive_prefix\n  Use simpler relative_path when set_git_dir\n\n cache.h               |  1 +\n path.c                | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++\n setup.c               |  5 +---\n t/t0060-path-utils.sh | 60 +++++++++++++++++++++++++----------------------\n 4 files changed, 99 insertions(+), 32 deletions(-)\n\n-- \n1.8.4.459.gd80d422\n"},{"id":"227607","messageId":"6533cbb59cd4de1d616ef62898f64a5cd144a561.1379048276.git.worldhello.net@gmail.com","threadId":"34924","inReplyTo":"cover.1379048276.git.worldhello.net@gmail.com","subject":"[PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-09-13T05:08:12Z","receivedAt":"2013-09-13T05:08:12Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"In test cases for relative_path, path with one leading character\n(such as /a, /x) may be recogonized as \"a:/\" or \"x:/\" if there is\nsuch doc drive on MINGW platform. Use an umambigous leading path\n\"/foo\" instead.\n\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n t/t0060-path-utils.sh | 56 +++++++++++++++++++++++++--------------------------\n 1 file changed, 28 insertions(+), 28 deletions(-)\n\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 3a48de2..82a6f21 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -190,33 +190,33 @@ test_expect_success SYMLINKS 'real path works on symlinks' '\n \ttest \"$sym\" = \"$(test-path-utils real_path \"$dir2/syml\")\"\n '\n \n-relative_path /a/b/c/\t/a/b/\t\tc/\n-relative_path /a/b/c/\t/a/b\t\tc/\n-relative_path /a//b//c/\t//a/b//\t\tc/\tPOSIX\n-relative_path /a/b\t/a/b\t\t./\n-relative_path /a/b/\t/a/b\t\t./\n-relative_path /a\t/a/b\t\t../\n-relative_path /\t\t/a/b/\t\t../../\n-relative_path /a/c\t/a/b/\t\t../c\n-relative_path /a/c\t/a/b\t\t../c\n-relative_path /x/y\t/a/b/\t\t../../x/y\n-relative_path /a/b\t\"<empty>\"\t/a/b\n-relative_path /a/b \t\"<null>\"\t/a/b\n-relative_path a/b/c/\ta/b/\t\tc/\n-relative_path a/b/c/\ta/b\t\tc/\n-relative_path a/b//c\ta//b\t\tc\n-relative_path a/b/\ta/b/\t\t./\n-relative_path a/b/\ta/b\t\t./\n-relative_path a\t\ta/b\t\t../\n-relative_path x/y\ta/b\t\t../../x/y\n-relative_path a/c\ta/b\t\t../c\n-relative_path a/b\t\"<empty>\"\ta/b\n-relative_path a/b \t\"<null>\"\ta/b\n-relative_path \"<empty>\"\t/a/b\t\t./\n-relative_path \"<empty>\"\t\"<empty>\"\t./\n-relative_path \"<empty>\"\t\"<null>\"\t./\n-relative_path \"<null>\"\t\"<empty>\"\t./\n-relative_path \"<null>\"\t\"<null>\"\t./\n-relative_path \"<null>\"\t/a/b\t\t./\n+relative_path /foo/a/b/c/\t/foo/a/b/\tc/\n+relative_path /foo/a/b/c/\t/foo/a/b\tc/\n+relative_path /foo/a//b//c/\t//foo/a/b//\tc/\t\tPOSIX\n+relative_path /foo/a/b\t\t/foo/a/b\t./\n+relative_path /foo/a/b/\t\t/foo/a/b\t./\n+relative_path /foo/a\t\t/foo/a/b\t../\n+relative_path /\t\t\t/foo/a/b/\t../../../\n+relative_path /foo/a/c\t\t/foo/a/b/\t../c\n+relative_path /foo/a/c\t\t/foo/a/b\t../c\n+relative_path /foo/x/y\t\t/foo/a/b/\t../../x/y\n+relative_path /foo/a/b\t\t\"<empty>\"\t/foo/a/b\n+relative_path /foo/a/b \t\t\"<null>\"\t/foo/a/b\n+relative_path foo/a/b/c/\tfoo/a/b/\tc/\n+relative_path foo/a/b/c/\tfoo/a/b\t\tc/\n+relative_path foo/a/b//c\tfoo/a//b\tc\n+relative_path foo/a/b/\t\tfoo/a/b/\t./\n+relative_path foo/a/b/\t\tfoo/a/b\t\t./\n+relative_path foo/a\t\tfoo/a/b\t\t../\n+relative_path foo/x/y\t\tfoo/a/b\t\t../../x/y\n+relative_path foo/a/c\t\tfoo/a/b\t\t../c\n+relative_path foo/a/b\t\t\"<empty>\"\tfoo/a/b\n+relative_path foo/a/b \t\t\"<null>\"\tfoo/a/b\n+relative_path \"<empty>\"\t\t/foo/a/b\t./\n+relative_path \"<empty>\"\t\t\"<empty>\"\t./\n+relative_path \"<empty>\"\t\t\"<null>\"\t./\n+relative_path \"<null>\"\t\t\"<empty>\"\t./\n+relative_path \"<null>\"\t\t\"<null>\"\t./\n+relative_path \"<null>\"\t\t/foo/a/b\t./\n \n test_done\n-- \n1.8.4.459.gd80d422\n"},{"id":"227608","messageId":"79cfcc0c66eb19e3621fff2dafefdddbcbc824cf.1379048276.git.worldhello.net@gmail.com","threadId":"34924","inReplyTo":"cover.1379048276.git.worldhello.net@gmail.com","subject":"[PATCH v2 2/3] relative_path should honor dos_drive_prefix","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-09-13T05:08:13Z","receivedAt":"2013-09-13T05:08:13Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Tvangeste found that the \"relative_path\" function could not work\nproperly on Windows if \"in\" and \"prefix\" have dos driver prefix.\n($gmane/234434)\n\ne.g., When execute: test-path-utils relative_path \"C:/a/b\" \"D:/x/y\",\nshould return \"C:/a/b\", but returns \"../../C:/a/b\", which is wrong.\n\nSo make relative_path honor dos_drive_prefix, and add test cases\nfor it in t0060.\n\nReported-by: Tvangeste <i.4m.l33t@yandex.ru>\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n path.c                | 20 ++++++++++++++++++++\n t/t0060-path-utils.sh |  4 ++++\n 2 files changed, 24 insertions(+)\n\ndiff --git a/path.c b/path.c\nindex 9fd28bcd..65d376d 100644\n--- a/path.c\n+++ b/path.c\n@@ -434,6 +434,16 @@ int adjust_shared_perm(const char *path)\n \treturn 0;\n }\n \n+static int have_same_root(const char *path1, const char *path2)\n+{\n+\tint is_abs1, is_abs2;\n+\n+\tis_abs1 = is_absolute_path(path1);\n+\tis_abs2 = is_absolute_path(path2);\n+\treturn (is_abs1 && is_abs2 && tolower(path1[0]) == tolower(path2[0])) ||\n+\t       (!is_abs1 && !is_abs2);\n+}\n+\n /*\n  * Give path as relative to prefix.\n  *\n@@ -454,6 +464,16 @@ const char *relative_path(const char *in, const char *prefix,\n \telse if (!prefix_len)\n \t\treturn in;\n \n+\tif (have_same_root(in, prefix)) {\n+\t\t/* bypass dos_drive, for \"c:\" is identical to \"C:\" */\n+\t\tif (has_dos_drive_prefix(in)) {\n+\t\t\ti = 2;\n+\t\t\tj = 2;\n+\t\t}\n+\t} else {\n+\t\treturn in;\n+\t}\n+\n \twhile (i < prefix_len && j < in_len && prefix[i] == in[j]) {\n \t\tif (is_dir_sep(prefix[i])) {\n \t\t\twhile (is_dir_sep(prefix[i]))\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 82a6f21..0187d11 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -210,6 +210,10 @@ relative_path foo/a/b/\t\tfoo/a/b\t\t./\n relative_path foo/a\t\tfoo/a/b\t\t../\n relative_path foo/x/y\t\tfoo/a/b\t\t../../x/y\n relative_path foo/a/c\t\tfoo/a/b\t\t../c\n+relative_path foo/a/b\t\t/foo/x/y\tfoo/a/b\n+relative_path /foo/a/b\t\tfoo/x/y\t\t/foo/a/b\n+relative_path d:/a/b\t\tD:/a/c\t\t../b\t\tMINGW\n+relative_path C:/a/b\t\tD:/a/c\t\tC:/a/b\t\tMINGW\n relative_path foo/a/b\t\t\"<empty>\"\tfoo/a/b\n relative_path foo/a/b \t\t\"<null>\"\tfoo/a/b\n relative_path \"<empty>\"\t\t/foo/a/b\t./\n-- \n1.8.4.459.gd80d422\n"},{"id":"227610","messageId":"c7675369e45b7bc2b3e99047f0386be5e05825e6.1379048276.git.worldhello.net@gmail.com","threadId":"34924","inReplyTo":"cover.1379048276.git.worldhello.net@gmail.com","subject":"[PATCH v2 3/3] Use simpler relative_path when set_git_dir","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-09-13T05:08:14Z","receivedAt":"2013-09-13T05:08:14Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Using a relative_path as git_dir first appears in v1.5.6-1-g044bbbc.\nIt will make git_dir shorter only if git_dir is inside work_tree,\nand this will increase performance. But my last refactor effort on\nrelative_path function (commit v1.8.3-rc2-12-ge02ca72) changed that.\nAlways use relative_path as git_dir may bring troubles like\n$gmane/234434.\n\nBecause new relative_path is a combination of original relative_path\nfrom path.c and original path_relative from quote.c, so in order to\nrestore the origin implementation, save the original relative_path\nas remove_leading_path, and call it in setup.c.\n\nSuggested-by: Karsten Blees <karsten.blees@gmail.com>\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n cache.h |  1 +\n path.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++\n setup.c |  5 +----\n 3 files changed, 47 insertions(+), 4 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex a47b9c0..73fa334 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -747,6 +747,7 @@ int is_directory(const char *);\n const char *real_path(const char *path);\n const char *real_path_if_valid(const char *path);\n const char *absolute_path(const char *path);\n+const char *remove_leading_path(const char *in, const char *prefix);\n const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\n int normalize_path_copy(char *dst, const char *src);\ndiff --git a/path.c b/path.c\nindex 65d376d..24594c4 100644\n--- a/path.c\n+++ b/path.c\n@@ -551,6 +551,51 @@ const char *relative_path(const char *in, const char *prefix,\n }\n \n /*\n+ * A simpler implementation of relative_path\n+ *\n+ * Get relative path by removing \"prefix\" from \"in\". This function\n+ * first appears in v1.5.6-1-g044bbbc, and makes git_dir shorter\n+ * to increase performance when traversing the path to work_tree.\n+ */\n+const char *remove_leading_path(const char *in, const char *prefix)\n+{\n+\tstatic char buf[PATH_MAX + 1];\n+\tint i = 0, j = 0;\n+\n+\tif (!prefix || !prefix[0])\n+\t\treturn in;\n+\twhile (prefix[i]) {\n+\t\tif (is_dir_sep(prefix[i])) {\n+\t\t\tif (!is_dir_sep(in[j]))\n+\t\t\t\treturn in;\n+\t\t\twhile (is_dir_sep(prefix[i]))\n+\t\t\t\ti++;\n+\t\t\twhile (is_dir_sep(in[j]))\n+\t\t\t\tj++;\n+\t\t\tcontinue;\n+\t\t} else if (in[j] != prefix[i]) {\n+\t\t\treturn in;\n+\t\t}\n+\t\ti++;\n+\t\tj++;\n+\t}\n+\tif (\n+\t    /* \"/foo\" is a prefix of \"/foo\" */\n+\t    in[j] &&\n+\t    /* \"/foo\" is not a prefix of \"/foobar\" */\n+\t    !is_dir_sep(prefix[i-1]) && !is_dir_sep(in[j])\n+\t   )\n+\t\treturn in;\n+\twhile (is_dir_sep(in[j]))\n+\t\tj++;\n+\tif (!in[j])\n+\t\tstrcpy(buf, \".\");\n+\telse\n+\t\tstrcpy(buf, in + j);\n+\treturn buf;\n+}\n+\n+/*\n  * It is okay if dst == src, but they should not overlap otherwise.\n  *\n  * Performs the following normalizations on src, storing the result in dst:\ndiff --git a/setup.c b/setup.c\nindex f08dd64..dbf4138 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -227,7 +227,6 @@ int is_inside_work_tree(void)\n \n void setup_work_tree(void)\n {\n-\tstruct strbuf sb = STRBUF_INIT;\n \tconst char *work_tree, *git_dir;\n \tstatic int initialized = 0;\n \n@@ -247,10 +246,8 @@ void setup_work_tree(void)\n \tif (getenv(GIT_WORK_TREE_ENVIRONMENT))\n \t\tsetenv(GIT_WORK_TREE_ENVIRONMENT, \".\", 1);\n \n-\tset_git_dir(relative_path(git_dir, work_tree, &sb));\n+\tset_git_dir(remove_leading_path(git_dir, work_tree));\n \tinitialized = 1;\n-\n-\tstrbuf_release(&sb);\n }\n \n static int check_repository_format_gently(const char *gitdir, int *nongit_ok)\n-- \n1.8.4.459.gd80d422\n"},{"id":"227644","messageId":"xmqqtxhoijpz.fsf@gitster.dls.corp.google.com","threadId":"34924","inReplyTo":"6533cbb59cd4de1d616ef62898f64a5cd144a561.1379048276.git.worldhello.net@gmail.com","subject":"Re: [PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-13T19:51:04Z","receivedAt":"2013-09-13T19:51:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n> In test cases for relative_path, path with one leading character\n> (such as /a, /x) may be recogonized as \"a:/\" or \"x:/\" if there is\n> such doc drive on MINGW platform. Use an umambigous leading path\n> \"/foo\" instead.\n\n\"DOS drive\", you mean?\n\nAre they really spelled as /a or /x (not e.g. //a or something)?\n\nJust double-checking.\n\n> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\n> ---\n>  t/t0060-path-utils.sh | 56 +++++++++++++++++++++++++--------------------------\n>  1 file changed, 28 insertions(+), 28 deletions(-)\n>\n> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\n> index 3a48de2..82a6f21 100755\n> --- a/t/t0060-path-utils.sh\n> +++ b/t/t0060-path-utils.sh\n> @@ -190,33 +190,33 @@ test_expect_success SYMLINKS 'real path works on symlinks' '\n>  \ttest \"$sym\" = \"$(test-path-utils real_path \"$dir2/syml\")\"\n>  '\n>  \n> -relative_path /a/b/c/\t/a/b/\t\tc/\n> -relative_path /a/b/c/\t/a/b\t\tc/\n> -relative_path /a//b//c/\t//a/b//\t\tc/\tPOSIX\n> -relative_path /a/b\t/a/b\t\t./\n> -relative_path /a/b/\t/a/b\t\t./\n> -relative_path /a\t/a/b\t\t../\n> -relative_path /\t\t/a/b/\t\t../../\n> -relative_path /a/c\t/a/b/\t\t../c\n> -relative_path /a/c\t/a/b\t\t../c\n> -relative_path /x/y\t/a/b/\t\t../../x/y\n> -relative_path /a/b\t\"<empty>\"\t/a/b\n> -relative_path /a/b \t\"<null>\"\t/a/b\n> -relative_path a/b/c/\ta/b/\t\tc/\n> -relative_path a/b/c/\ta/b\t\tc/\n> -relative_path a/b//c\ta//b\t\tc\n> -relative_path a/b/\ta/b/\t\t./\n> -relative_path a/b/\ta/b\t\t./\n> -relative_path a\t\ta/b\t\t../\n> -relative_path x/y\ta/b\t\t../../x/y\n> -relative_path a/c\ta/b\t\t../c\n> -relative_path a/b\t\"<empty>\"\ta/b\n> -relative_path a/b \t\"<null>\"\ta/b\n> -relative_path \"<empty>\"\t/a/b\t\t./\n> -relative_path \"<empty>\"\t\"<empty>\"\t./\n> -relative_path \"<empty>\"\t\"<null>\"\t./\n> -relative_path \"<null>\"\t\"<empty>\"\t./\n> -relative_path \"<null>\"\t\"<null>\"\t./\n> -relative_path \"<null>\"\t/a/b\t\t./\n> +relative_path /foo/a/b/c/\t/foo/a/b/\tc/\n> +relative_path /foo/a/b/c/\t/foo/a/b\tc/\n> +relative_path /foo/a//b//c/\t//foo/a/b//\tc/\t\tPOSIX\n> +relative_path /foo/a/b\t\t/foo/a/b\t./\n> +relative_path /foo/a/b/\t\t/foo/a/b\t./\n> +relative_path /foo/a\t\t/foo/a/b\t../\n> +relative_path /\t\t\t/foo/a/b/\t../../../\n> +relative_path /foo/a/c\t\t/foo/a/b/\t../c\n> +relative_path /foo/a/c\t\t/foo/a/b\t../c\n> +relative_path /foo/x/y\t\t/foo/a/b/\t../../x/y\n> +relative_path /foo/a/b\t\t\"<empty>\"\t/foo/a/b\n> +relative_path /foo/a/b \t\t\"<null>\"\t/foo/a/b\n> +relative_path foo/a/b/c/\tfoo/a/b/\tc/\n> +relative_path foo/a/b/c/\tfoo/a/b\t\tc/\n> +relative_path foo/a/b//c\tfoo/a//b\tc\n> +relative_path foo/a/b/\t\tfoo/a/b/\t./\n> +relative_path foo/a/b/\t\tfoo/a/b\t\t./\n> +relative_path foo/a\t\tfoo/a/b\t\t../\n> +relative_path foo/x/y\t\tfoo/a/b\t\t../../x/y\n> +relative_path foo/a/c\t\tfoo/a/b\t\t../c\n> +relative_path foo/a/b\t\t\"<empty>\"\tfoo/a/b\n> +relative_path foo/a/b \t\t\"<null>\"\tfoo/a/b\n> +relative_path \"<empty>\"\t\t/foo/a/b\t./\n> +relative_path \"<empty>\"\t\t\"<empty>\"\t./\n> +relative_path \"<empty>\"\t\t\"<null>\"\t./\n> +relative_path \"<null>\"\t\t\"<empty>\"\t./\n> +relative_path \"<null>\"\t\t\"<null>\"\t./\n> +relative_path \"<null>\"\t\t/foo/a/b\t./\n>  \n>  test_done\n"},{"id":"227671","messageId":"5233FE13.4070006@web.de","threadId":"34924","inReplyTo":"79cfcc0c66eb19e3621fff2dafefdddbcbc824cf.1379048276.git.worldhello.net@gmail.com","subject":"Re: [PATCH v2 2/3] relative_path should honor dos_drive_prefix","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-09-14T06:11:31Z","receivedAt":"2013-09-14T06:11:31Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 13.09.13 07:08, Jiang Xin wrote:\n> Tvangeste found that the \"relative_path\" function could not work\n> properly on Windows if \"in\" and \"prefix\" have dos driver prefix.\n> ($gmane/234434)\n>\n> e.g., When execute: test-path-utils relative_path \"C:/a/b\" \"D:/x/y\",\n> should return \"C:/a/b\", but returns \"../../C:/a/b\", which is wrong.\n>\n> So make relative_path honor dos_drive_prefix, and add test cases\n> for it in t0060.\n>\n> Reported-by: Tvangeste <i.4m.l33t@yandex.ru>\n> Helped-by: Johannes Sixt <j6t@kdbg.org>\n> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\n> ---\n>  path.c                | 20 ++++++++++++++++++++\n>  t/t0060-path-utils.sh |  4 ++++\n>  2 files changed, 24 insertions(+)\n>\n> diff --git a/path.c b/path.c\n> index 9fd28bcd..65d376d 100644\n> --- a/path.c\n> +++ b/path.c\n> @@ -434,6 +434,16 @@ int adjust_shared_perm(const char *path)\n>  \treturn 0;\n>  }\n>  \n> +static int have_same_root(const char *path1, const char *path2)\n> +{\n> +\tint is_abs1, is_abs2;\n> +\n> +\tis_abs1 = is_absolute_path(path1);\n> +\tis_abs2 = is_absolute_path(path2);\n> +\treturn (is_abs1 && is_abs2 && tolower(path1[0]) == tolower(path2[0])) ||\n> +\t       (!is_abs1 && !is_abs2);\n> +}\n> +\nI think the name of the fuction is somewhat misleading, as we are not sure if\nthey really have the same root.\nAnd that is investigated further down.\n\nmay_have_same_root() could be a better name.\n\n[snip]\n\n>  \twhile (i < prefix_len && j < in_len && prefix[i] == in[j]) {\n>  \t\tif (is_dir_sep(prefix[i])) {\n>  \t\t\twhile (is_dir_sep(prefix[i]))\n> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\n> index 82a6f21..0187d11 100755\n> --- a/t/t0060-path-utils.sh\n> +++ b/t/t0060-path-utils.sh\n> @@ -210,6 +210,10 @@ relative_path foo/a/b/\t\tfoo/a/b\t\t./\n>  relative_path foo/a\t\tfoo/a/b\t\t../\n>  relative_path foo/x/y\t\tfoo/a/b\t\t../../x/y\n>  relative_path foo/a/c\t\tfoo/a/b\t\t../c\n> +relative_path foo/a/b\t\t/foo/x/y\tfoo/a/b\n> +relative_path /foo/a/b\t\tfoo/x/y\t\t/foo/a/b\n> +relative_path d:/a/b\t\tD:/a/c\t\t../b\t\tMINGW\n> +relative_path C:/a/b\t\tD:/a/c\t\tC:/a/b\t\tMINGW\nSide question:\nWhat happens if we feed in a relative path with a dos drive?\nlike \"c:foo\" which is different from c:/foo.\n"},{"id":"227682","messageId":"523407AF.9080205@web.de","threadId":"34924","inReplyTo":"xmqqtxhoijpz.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-09-14T06:52:31Z","receivedAt":"2013-09-14T06:52:31Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2013-09-13 21.51, Junio C Hamano wrote:\n> Jiang Xin <worldhello.net@gmail.com> writes:\n> \n>> In test cases for relative_path, path with one leading character\n>> (such as /a, /x) may be recogonized as \"a:/\" or \"x:/\" if there is\n>> such doc drive on MINGW platform. Use an umambigous leading path\n>> \"/foo\" instead.\n> \n> \"DOS drive\", you mean?\n> \n> Are they really spelled as /a or /x (not e.g. //a or something)?\n> \n> Just double-checking.\nYes,\nthere is a directoctory structure in / like this:\n\n/usr\n/bin\n/lib\nThen we have the drive letters mapped to single letters:\n/c/Documents and Settings\n/c/temp\n\nAs an alternative\nc:/temp can be used\nor the DOS style\n\"c:\\temp\"\n\nAnd the // or \"\\\\\" is used for the UNC names (Universal Name Convention)\n//Servername/ShareName/Directory\n\n/Torsten\n"},{"id":"227754","messageId":"xmqqd2o71kwa.fsf@gitster.dls.corp.google.com","threadId":"34924","inReplyTo":"523407AF.9080205@web.de","subject":"Re: [PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-17T16:19:01Z","receivedAt":"2013-09-17T16:19:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> Yes,\n> there is a directoctory structure in / like this:\n>\n> /usr\n> /bin\n> /lib\n> Then we have the drive letters mapped to single letters:\n> /c/Documents and Settings\n> /c/temp\n\nThanks.\n"}]}