{"thread":{"id":"50093","subject":"[PATCH 0/1] Make abspath() aware of case-insensitive filesystems","startedAt":"2018-12-21T11:32:23Z","lastAt":"2019-01-18T13:24:59Z","messageCount":15,"participants":["Johannes Schindelin via GitGitGadget","Carlo Arenas","Johannes Schindelin","Junio C Hamano","Torsten Bögershausen"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"365724","messageId":"pull.104.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":null,"subject":"[PATCH 0/1] Make abspath() aware of case-insensitive filesystems","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-21T11:32:19Z","receivedAt":"2018-12-21T11:32:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is completely legitimate these days to call git add with absolute paths.\nOf course, on a case-insensitive file system, users rightfully expect the\nargument to be handled case-insensitively, too. This patch makes it so.\n\nGit for Windows carried this patch for over one and a half years already, I\nthink it is time to get it into git.git.\n\nJohannes Schindelin (1):\n  abspath_part_inside_repo: respect core.fileMode\n\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\n\nbase-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/104\n-- \ngitgitgadget\n"},{"id":"365725","messageId":"4fb5de504e9b48a35075cb87f4158149055f1a13.1545391939.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.git.gitgitgadget@gmail.com","subject":"[PATCH 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-21T11:32:20Z","receivedAt":"2018-12-21T11:32:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIf the file system is case-insensitive, we really must be careful to\nignore differences in case only.\n\nThis fixes https://github.com/git-for-windows/git/issues/735\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 1be5037f12..291bfb2128 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path)\n \toff = offset_1st_component(path);\n \n \t/* check if work tree is already the prefix */\n-\tif (wtlen <= len && !strncmp(path, work_tree, wtlen)) {\n+\tif (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {\n \t\tif (path[wtlen] == '/') {\n \t\t\tmemmove(path, path + wtlen + 1, len - wtlen);\n \t\t\treturn 0;\n@@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path)\n \t\tpath++;\n \t\tif (*path == '/') {\n \t\t\t*path = '\\0';\n-\t\t\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\t\t\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t\t\tmemmove(path0, path + 1, len - (path - path0));\n \t\t\t\treturn 0;\n \t\t\t}\n@@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path)\n \t}\n \n \t/* check whole path */\n-\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t*path0 = '\\0';\n \t\treturn 0;\n \t}\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 37729ba258..8ee4fc70ad 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' '\n \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n '\n \n+test_expect_success MINGW 'path is case-insensitive' '\n+\tpath=\"$(pwd)/BLUB\" &&\n+\ttouch \"$path\" &&\n+\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n+\tgit add \"$downcased\"\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"365755","messageId":"CAPUEspjJSHfNtu8CyLjfRJ3JSzvP2WYcQ8f7Dp5L9vRaXvf0=g@mail.gmail.com","threadId":"50093","inReplyTo":"4fb5de504e9b48a35075cb87f4158149055f1a13.1545391939.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2018-12-22T18:11:07Z","receivedAt":"2018-12-22T18:11:25Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Fri, Dec 21, 2018 at 8:34 AM Johannes Schindelin via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> +test_expect_success MINGW 'path is case-insensitive' '\n\nCASE_INSENSITIVE_FS might be a better prereq\n\nCarlo\n"},{"id":"365785","messageId":"nycvar.QRO.7.76.6.1812241954210.45@tvgsbejvaqbjf.bet","threadId":"50093","inReplyTo":"CAPUEspjJSHfNtu8CyLjfRJ3JSzvP2WYcQ8f7Dp5L9vRaXvf0=g@mail.gmail.com","subject":"Re: [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-12-24T18:54:37Z","receivedAt":"2018-12-24T18:54:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Carlo,\n\nOn Sat, 22 Dec 2018, Carlo Arenas wrote:\n\n> On Fri, Dec 21, 2018 at 8:34 AM Johannes Schindelin via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n> > +test_expect_success MINGW 'path is case-insensitive' '\n> \n> CASE_INSENSITIVE_FS might be a better prereq\n\nYou're right, the path that I downcase in the test contains an upper case\n\"BLUB\" component.\n\nWill fix,\nJohannes\n"},{"id":"365792","messageId":"pull.104.v2.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.git.gitgitgadget@gmail.com","subject":"[PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-24T22:34:05Z","receivedAt":"2018-12-24T22:34:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is completely legitimate these days to call git add with absolute paths.\nOf course, on a case-insensitive file system, users rightfully expect the\nargument to be handled case-insensitively, too. This patch makes it so.\n\nGit for Windows carried this patch for over one and a half years already, I\nthink it is time to get it into git.git.\n\nChange since v1:\n\n * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS.\n\nJohannes Schindelin (1):\n  abspath_part_inside_repo: respect core.fileMode\n\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\n\nbase-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/104\n\nRange-diff vs v1:\n\n 1:  4fb5de504e = 1:  3eaec10c46 abspath_part_inside_repo: respect core.fileMode\n\n-- \ngitgitgadget\n"},{"id":"365793","messageId":"3eaec10c46bdb1a4a1795ae16a76cef15d541ff5.1545690845.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.v2.git.gitgitgadget@gmail.com","subject":"[PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-24T22:34:06Z","receivedAt":"2018-12-24T22:34:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIf the file system is case-insensitive, we really must be careful to\nignore differences in case only.\n\nThis fixes https://github.com/git-for-windows/git/issues/735\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 1be5037f12..291bfb2128 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path)\n \toff = offset_1st_component(path);\n \n \t/* check if work tree is already the prefix */\n-\tif (wtlen <= len && !strncmp(path, work_tree, wtlen)) {\n+\tif (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {\n \t\tif (path[wtlen] == '/') {\n \t\t\tmemmove(path, path + wtlen + 1, len - wtlen);\n \t\t\treturn 0;\n@@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path)\n \t\tpath++;\n \t\tif (*path == '/') {\n \t\t\t*path = '\\0';\n-\t\t\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\t\t\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t\t\tmemmove(path0, path + 1, len - (path - path0));\n \t\t\t\treturn 0;\n \t\t\t}\n@@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path)\n \t}\n \n \t/* check whole path */\n-\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t*path0 = '\\0';\n \t\treturn 0;\n \t}\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 37729ba258..8ee4fc70ad 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' '\n \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n '\n \n+test_expect_success MINGW 'path is case-insensitive' '\n+\tpath=\"$(pwd)/BLUB\" &&\n+\ttouch \"$path\" &&\n+\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n+\tgit add \"$downcased\"\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"365794","messageId":"b935e11d21fc2a34953d1fc651ea09f1a4c1a769.1545692162.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.v3.git.gitgitgadget@gmail.com","subject":"[PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-24T22:56:04Z","receivedAt":"2018-12-24T22:56:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIf the file system is case-insensitive, we really must be careful to\nignore differences in case only.\n\nThis fixes https://github.com/git-for-windows/git/issues/735\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 1be5037f12..291bfb2128 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path)\n \toff = offset_1st_component(path);\n \n \t/* check if work tree is already the prefix */\n-\tif (wtlen <= len && !strncmp(path, work_tree, wtlen)) {\n+\tif (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {\n \t\tif (path[wtlen] == '/') {\n \t\t\tmemmove(path, path + wtlen + 1, len - wtlen);\n \t\t\treturn 0;\n@@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path)\n \t\tpath++;\n \t\tif (*path == '/') {\n \t\t\t*path = '\\0';\n-\t\t\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\t\t\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t\t\tmemmove(path0, path + 1, len - (path - path0));\n \t\t\t\treturn 0;\n \t\t\t}\n@@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path)\n \t}\n \n \t/* check whole path */\n-\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t*path0 = '\\0';\n \t\treturn 0;\n \t}\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 37729ba258..be582a513b 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' '\n \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n '\n \n+test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '\n+\tpath=\"$(pwd)/BLUB\" &&\n+\ttouch \"$path\" &&\n+\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n+\tgit add \"$downcased\"\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"365795","messageId":"pull.104.v3.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.v2.git.gitgitgadget@gmail.com","subject":"[PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-12-24T22:56:03Z","receivedAt":"2018-12-24T22:56:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is completely legitimate these days to call git add with absolute paths.\nOf course, on a case-insensitive file system, users rightfully expect the\nargument to be handled case-insensitively, too. This patch makes it so.\n\nGit for Windows carried this patch for over one and a half years already, I\nthink it is time to get it into git.git.\n\nChange since v2:\n\n * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS. v1 was\n   sent out without a change by mistake. Sorry.\n\nJohannes Schindelin (1):\n  abspath_part_inside_repo: respect core.fileMode\n\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\n\nbase-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/104\n\nRange-diff vs v2:\n\n 1:  3eaec10c46 ! 1:  b935e11d21 abspath_part_inside_repo: respect core.fileMode\n     @@ -47,7 +47,7 @@\n       \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n       '\n       \n     -+test_expect_success MINGW 'path is case-insensitive' '\n     ++test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '\n      +\tpath=\"$(pwd)/BLUB\" &&\n      +\ttouch \"$path\" &&\n      +\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n\n-- \ngitgitgadget\n"},{"id":"365797","messageId":"xmqqftumb8zv.fsf@gitster-ct.c.googlers.com","threadId":"50093","inReplyTo":"b935e11d21fc2a34953d1fc651ea09f1a4c1a769.1545692162.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-12-25T03:06:28Z","receivedAt":"2018-12-25T03:06:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> diff --git a/setup.c b/setup.c\n> index 1be5037f12..291bfb2128 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path)\n>  \toff = offset_1st_component(path);\n>  \n>  \t/* check if work tree is already the prefix */\n> -\tif (wtlen <= len && !strncmp(path, work_tree, wtlen)) {\n> +\tif (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {\n>  \t\tif (path[wtlen] == '/') {\n>  \t\t\tmemmove(path, path + wtlen + 1, len - wtlen);\n>  \t\t\treturn 0;\n> @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path)\n>  \t\tpath++;\n>  \t\tif (*path == '/') {\n>  \t\t\t*path = '\\0';\n> -\t\t\tif (strcmp(real_path(path0), work_tree) == 0) {\n> +\t\t\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n>  \t\t\t\tmemmove(path0, path + 1, len - (path - path0));\n>  \t\t\t\treturn 0;\n>  \t\t\t}\n> @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path)\n>  \t}\n>  \n>  \t/* check whole path */\n> -\tif (strcmp(real_path(path0), work_tree) == 0) {\n> +\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n>  \t\t*path0 = '\\0';\n>  \t\treturn 0;\n>  \t}\n\nSo the idea is that the path to the top level of the working tree\nmust be compared with fspath[n]cmp() to what was given.  After\nstripping that prefix, the caller uses the result just like it uses\na non-absolute path, which is why the necessary changes are isolated\nto this function.\n\nMakes sense.\n\n> diff --git a/t/t3700-add.sh b/t/t3700-add.sh\n> index 37729ba258..be582a513b 100755\n> --- a/t/t3700-add.sh\n> +++ b/t/t3700-add.sh\n> @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' '\n>  \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n>  '\n>  \n> +test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '\n> +\tpath=\"$(pwd)/BLUB\" &&\n> +\ttouch \"$path\" &&\n> +\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n> +\tgit add \"$downcased\"\n> +'\n\nOne problem with the above test is that it leaves it unspecified if\nthe resulting index entry is \"blub\" or \"BLUB\".  Shouldn't we verify\nthat \"git add\" adds an expected path to the index, instead of\nblindly trusting that it says \"Yeah, I did as I was told\" with its\nexit status?  Would we be adding 'blub' as that is what we told\n'git' to add, or would it be 'BLUB' as that is what exists on the\nfilesystem that is case insensitive but case preserving?\n\nOn a project whose participants all are on case insensitive\nfilesystems, the above does not matter by definition, but once a\nproject wants to work with their case sensitive friends, it starts\nto matter.\n\nOther than that, looks good to me.\n\nThanks.\n\n\n> +\n>  test_done\n"},{"id":"365798","messageId":"xmqqa7kuat8j.fsf@gitster-ct.c.googlers.com","threadId":"50093","inReplyTo":"xmqqftumb8zv.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-12-25T08:46:52Z","receivedAt":"2018-12-25T08:46:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> the resulting index entry is \"blub\" or \"BLUB\".  Shouldn't we verify\n> that \"git add\" adds an expected path to the index, instead of\n> blindly trusting that it says \"Yeah, I did as I was told\" with its\n> exit status?  Would we be adding 'blub' as that is what we told\n> 'git' to add, or would it be 'BLUB' as that is what exists on the\n> filesystem that is case insensitive but case preserving?\n\nNeedless to say, the last part of the above is a mere thetorical\nquestion, and I am not questioning the established behaviour or\nsuggesting to \"improve\" it.  On a case insensitive filesystem, we\ntrust what readdir() gave us (but match them with pathspec case\ninsensitively) for a new path that is not in the index.  When we\nupdate the contents of a path that is already in the index, we\npreserve the case in the index, even when readdir() reports the same\npath in different case (iow, we trust the case in the index more\nthan what readdir() gives us)..\n\nWhat I am wondering in the above is if we should document that in\nthe test, perhaps with a simple\n\n\tgit ls-files blub >actual &&\n\techo BLUB >expect &&\n\ttest_cmp expect actual\n\nor something like that.\n"},{"id":"365799","messageId":"20181225104256.GA29443@tor.lan","threadId":"50093","inReplyTo":"3eaec10c46bdb1a4a1795ae16a76cef15d541ff5.1545690845.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-12-25T10:42:57Z","receivedAt":"2018-12-25T10:47:49Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\nShould it be\ns/respect core.fileMode/respect core.ignoreCase/\n\nin the header line ?\n"},{"id":"367088","messageId":"nycvar.QRO.7.76.6.1901181351250.41@tvgsbejvaqbjf.bet","threadId":"50093","inReplyTo":"xmqqa7kuat8j.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-18T12:55:17Z","receivedAt":"2019-01-18T12:55:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nfirst of all, my apologies for the incorrect commit message (you missed\nit, too, though): it is not about respecting core.fileMode, but about\ncore.ignoreCase.\n\nOn Tue, 25 Dec 2018, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > the resulting index entry is \"blub\" or \"BLUB\".  Shouldn't we verify\n> > that \"git add\" adds an expected path to the index, instead of\n> > blindly trusting that it says \"Yeah, I did as I was told\" with its\n> > exit status?  Would we be adding 'blub' as that is what we told\n> > 'git' to add, or would it be 'BLUB' as that is what exists on the\n> > filesystem that is case insensitive but case preserving?\n> \n> Needless to say, the last part of the above is a mere thetorical\n> question, and I am not questioning the established behaviour or\n> suggesting to \"improve\" it.  On a case insensitive filesystem, we\n> trust what readdir() gave us (but match them with pathspec case\n> insensitively) for a new path that is not in the index.  When we\n> update the contents of a path that is already in the index, we\n> preserve the case in the index, even when readdir() reports the same\n> path in different case (iow, we trust the case in the index more\n> than what readdir() gives us)..\n> \n> What I am wondering in the above is if we should document that in\n> the test, perhaps with a simple\n> \n> \tgit ls-files blub >actual &&\n> \techo BLUB >expect &&\n> \ttest_cmp expect actual\n> \n> or something like that.\n\nActually, I would interpret the description in our documentation to mean\nthat Git does not want to trust what readdir() gave us but heed what the\nuser said, i.e. when `BLUB` is added as `git add blub`, Git really should\nthink that it is `blub`, not `BLUB` (i.e. the exact opposite of what you\nsuggest). From Documentation/config/core.txt's section about\n`core.ignoreCase`:\n\n\tFor example, if a directory listing finds \"makefile\" when Git\n\texpects \"Makefile\", Git will assume it is really the same file,\n\tand continue to remember it as \"Makefile\".\n\nCiao,\nDscho\n"},{"id":"367089","messageId":"nycvar.QRO.7.76.6.1901181357540.41@tvgsbejvaqbjf.bet","threadId":"50093","inReplyTo":"20181225104256.GA29443@tor.lan","subject":"Re: [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-18T12:58:04Z","receivedAt":"2019-01-18T12:58:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Torsten,\n\nOn Tue, 25 Dec 2018, Torsten Bögershausen wrote:\n\n> \n> Should it be\n> s/respect core.fileMode/respect core.ignoreCase/\n> \n> in the header line ?\n\nYep. Fixed.\nDscho"},{"id":"367092","messageId":"pull.104.v4.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.v3.git.gitgitgadget@gmail.com","subject":"[PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-01-18T13:24:53Z","receivedAt":"2019-01-18T13:24:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is completely legitimate these days to call git add with absolute paths.\nOf course, on a case-insensitive file system, users rightfully expect the\nargument to be handled case-insensitively, too. This patch makes it so.\n\nGit for Windows carried this patch for over one and a half years already, I\nthink it is time to get it into git.git.\n\nChanges since v3:\n\n * Fixed the oneline (it talked about core.fileMode when it really wanted to\n   talk about core.ignoreCase!).\n\nChange since v2:\n\n * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS. v1 was\n   sent out without a change by mistake. Sorry.\n\nJohannes Schindelin (1):\n  abspath_part_inside_repo: respect core.ignoreCase\n\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\n\nbase-commit: 77556354bb7ac50450e3b28999e3576969869068\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-104%2Fdscho%2Fcase-insensitive-abspath-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v4\nPull-Request: https://github.com/gitgitgadget/git/pull/104\n\nRange-diff vs v3:\n\n 1:  b935e11d21 ! 1:  3fb927fc77 abspath_part_inside_repo: respect core.fileMode\n     @@ -1,6 +1,6 @@\n      Author: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n     -    abspath_part_inside_repo: respect core.fileMode\n     +    abspath_part_inside_repo: respect core.ignoreCase\n      \n          If the file system is case-insensitive, we really must be careful to\n          ignore differences in case only.\n\n-- \ngitgitgadget\n"},{"id":"367093","messageId":"3fb927fc77232279c1c85db003a5f55de4eabd29.1547817893.git.gitgitgadget@gmail.com","threadId":"50093","inReplyTo":"pull.104.v4.git.gitgitgadget@gmail.com","subject":"[PATCH v4 1/1] abspath_part_inside_repo: respect core.ignoreCase","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-01-18T13:24:54Z","receivedAt":"2019-01-18T13:24:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIf the file system is case-insensitive, we really must be careful to\nignore differences in case only.\n\nThis fixes https://github.com/git-for-windows/git/issues/735\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n setup.c        | 6 +++---\n t/t3700-add.sh | 7 +++++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 1be5037f12..291bfb2128 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path)\n \toff = offset_1st_component(path);\n \n \t/* check if work tree is already the prefix */\n-\tif (wtlen <= len && !strncmp(path, work_tree, wtlen)) {\n+\tif (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) {\n \t\tif (path[wtlen] == '/') {\n \t\t\tmemmove(path, path + wtlen + 1, len - wtlen);\n \t\t\treturn 0;\n@@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path)\n \t\tpath++;\n \t\tif (*path == '/') {\n \t\t\t*path = '\\0';\n-\t\t\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\t\t\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t\t\tmemmove(path0, path + 1, len - (path - path0));\n \t\t\t\treturn 0;\n \t\t\t}\n@@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path)\n \t}\n \n \t/* check whole path */\n-\tif (strcmp(real_path(path0), work_tree) == 0) {\n+\tif (fspathcmp(real_path(path0), work_tree) == 0) {\n \t\t*path0 = '\\0';\n \t\treturn 0;\n \t}\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 37729ba258..be582a513b 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' '\n \ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n '\n \n+test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '\n+\tpath=\"$(pwd)/BLUB\" &&\n+\ttouch \"$path\" &&\n+\tdowncased=\"$(echo \"$path\" | tr A-Z a-z)\" &&\n+\tgit add \"$downcased\"\n+'\n+\n test_done\n-- \ngitgitgadget\n"}]}