{"thread":{"id":"13476","subject":"[PATCH 4/4] t0050: Add test for case insensitive add","startedAt":"2008-05-11T16:16:39Z","lastAt":"2008-05-11T17:10:40Z","messageCount":6,"participants":["Steffen Prohaska","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"76627","messageId":"1210522602-4724-1-git-send-email-prohaska@zib.de","threadId":"13476","inReplyTo":null,"subject":"[PATCH 1/4] git-init: autodetect core.ignorecase","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-05-11T16:16:39Z","receivedAt":"2008-05-11T16:16:39Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"From: Dmitry Potapov <dpotapov@gmail.com>\n\nWe already detect if symbolic links are supported by the filesystem.\nThis patch adds autodetect for case-insensitive filesystems, such\nas VFAT and others.\n\nSigned-off-by: Dmitry Potapov <dpotapov@gmail.com>\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n builtin-init-db.c |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-init-db.c b/builtin-init-db.c\nindex 2854868..3721bd2 100644\n--- a/builtin-init-db.c\n+++ b/builtin-init-db.c\n@@ -255,8 +255,8 @@ static int create_default_files(const char *git_dir, const char *template_path)\n \t\t\tgit_config_set(\"core.worktree\", work_tree);\n \t}\n \n-\t/* Check if symlink is supported in the work tree */\n \tif (!reinit) {\n+\t\t/* Check if symlink is supported in the work tree */\n \t\tpath[len] = 0;\n \t\tstrcpy(path + len, \"tXXXXXX\");\n \t\tif (!close(xmkstemp(path)) &&\n@@ -267,6 +267,12 @@ static int create_default_files(const char *git_dir, const char *template_path)\n \t\t\tunlink(path); /* good */\n \t\telse\n \t\t\tgit_config_set(\"core.symlinks\", \"false\");\n+\n+\t\t/* Check if the filesystem is case-insensitive */\n+\t\tpath[len] = 0;\n+\t\tstrcpy(path + len, \"CoNfIg\");\n+\t\tif (!access(path, F_OK))\n+\t\t\tgit_config_set(\"core.ignorecase\", \"true\");\n \t}\n \n \treturn reinit;\n-- \n1.5.5.1.313.g9decb\n"},{"id":"76625","messageId":"1210522602-4724-2-git-send-email-prohaska@zib.de","threadId":"13476","inReplyTo":"1210522602-4724-1-git-send-email-prohaska@zib.de","subject":"[PATCH 2/4] t0050: Test autodetect core.ignorecase","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-05-11T16:16:40Z","receivedAt":"2008-05-11T16:16:40Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Verify if core.ignorecase is automatically set to 'true' during\nrepository initialization if the file system is case insensitive,\nand unset or 'false' otherwise.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n t/t0050-filesystem.sh |   16 ++++++++++++++++\n 1 files changed, 16 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh\nindex 3fbad77..66d3647 100755\n--- a/t/t0050-filesystem.sh\n+++ b/t/t0050-filesystem.sh\n@@ -7,6 +7,7 @@ test_description='Various filesystem issues'\n auml=`printf '\\xc3\\xa4'`\n aumlcdiar=`printf '\\x61\\xcc\\x88'`\n \n+case_insensitive=\n test_expect_success 'see if we expect ' '\n \n \ttest_case=test_expect_success\n@@ -17,6 +18,7 @@ test_expect_success 'see if we expect ' '\n \tif test \"$(cat junk/CamelCase)\" != good\n \tthen\n \t\ttest_case=test_expect_failure\n+\t\tcase_insensitive=t\n \t\tsay \"will test on a case insensitive filesystem\"\n \tfi &&\n \trm -fr junk &&\n@@ -32,6 +34,20 @@ test_expect_success 'see if we expect ' '\n \trm -fr junk\n '\n \n+if test \"$case_insensitive\"\n+then\n+test_expect_success \"detection of case insensitive filesystem during repo init\" '\n+\n+\ttest $(git config --bool core.ignorecase) = true\n+'\n+else\n+test_expect_success \"detection of case insensitive filesystem during repo init\" '\n+\n+\t! git config --bool core.ignorecase >/dev/null ||\n+\ttest $(git config --bool core.ignorecase) = false\n+'\n+fi\n+\n test_expect_success \"setup case tests\" '\n \n \ttouch camelcase &&\n-- \n1.5.5.1.313.g9decb\n"},{"id":"76626","messageId":"1210522602-4724-3-git-send-email-prohaska@zib.de","threadId":"13476","inReplyTo":"1210522602-4724-2-git-send-email-prohaska@zib.de","subject":"[PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-05-11T16:16:41Z","receivedAt":"2008-05-11T16:16:41Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Case insensitive file handling is only active when\ncore.ignorecase = true.  Hence, we need to set it to give the tests\nin t0050 a chance to succeed.  Setting core.ignorecase explicitly\nallows to test some aspects of case handling even on case sensitive file\nsystems.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n t/t0050-filesystem.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh\nindex 66d3647..399b45d 100755\n--- a/t/t0050-filesystem.sh\n+++ b/t/t0050-filesystem.sh\n@@ -50,6 +50,7 @@ fi\n \n test_expect_success \"setup case tests\" '\n \n+\tgit config core.ignorecase true &&\n \ttouch camelcase &&\n \tgit add camelcase &&\n \tgit commit -m \"initial\" &&\n-- \n1.5.5.1.313.g9decb\n"},{"id":"76624","messageId":"1210522602-4724-4-git-send-email-prohaska@zib.de","threadId":"13476","inReplyTo":"1210522602-4724-3-git-send-email-prohaska@zib.de","subject":"[PATCH 4/4] t0050: Add test for case insensitive add","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-05-11T16:16:42Z","receivedAt":"2008-05-11T16:16:42Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Add should recognize if a file is added with a different case and add\nthe file using its original name.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n t/t0050-filesystem.sh |   10 ++++++++++\n 1 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh\nindex 399b45d..0e33c4b 100755\n--- a/t/t0050-filesystem.sh\n+++ b/t/t0050-filesystem.sh\n@@ -77,6 +77,16 @@ $test_case 'merge (case change)' '\n \n '\n \n+$test_case 'add (with different case)' '\n+\n+\tgit reset --hard initial &&\n+\trm camelcase &&\n+\techo 1 >CamelCase &&\n+\tgit add CamelCase &&\n+\ttest $(git-ls-files | grep -i camelcase | wc -l) = 1\n+\n+'\n+\n test_expect_success \"setup unicode normalization tests\" '\n \n   test_create_repo unicode &&\n-- \n1.5.5.1.313.g9decb\n"},{"id":"76629","messageId":"1DDA0924-E726-4D3A-B936-D08678E9827A@zib.de","threadId":"13476","inReplyTo":"1210522602-4724-1-git-send-email-prohaska@zib.de","subject":"[PATCH 0/4] core.ignorecase","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-05-11T16:21:25Z","receivedAt":"2008-05-11T16:21:25Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"[ I forgot the \"--compose\" switch to \"\u0005git send-email\", so the intro\n   follows as a reply to PATCH 1/4. ]\n\n\nThis patch series improves initialization of a repository and adds  \nsome tests\nfor core.ignorecase.  It should be applied on top of lt/case- \ninsensitive.\n\n  [PATCH 1/4] git-init: autodetect core.ignorecase\n\n     1/4 was proposed some time ago as\n     http://mid.gmane.org/<20080325104931.GJ25381@dpotapov.dyndns.org>\n     but did not make it into Junio's next.\n\n  [PATCH 2/4] t0050: Test autodetect core.ignorecase\n  [PATCH 3/4] t0050: Set core.ignorecase case to activate case  \ninsensitivity\n  [PATCH 4/4] t0050: Add test for case insensitive add\n\n     2-4/4 add some tests.\n\n         Steffen\n"},{"id":"76640","messageId":"alpine.LFD.1.10.0805111005260.3330@woody.linux-foundation.org","threadId":"13476","inReplyTo":"1210522602-4724-3-git-send-email-prohaska@zib.de","subject":"Re: [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-05-11T17:10:40Z","receivedAt":"2008-05-11T17:10:40Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 11 May 2008, Steffen Prohaska wrote:\n>\n> Case insensitive file handling is only active when\n> core.ignorecase = true.  Hence, we need to set it to give the tests\n> in t0050 a chance to succeed.  Setting core.ignorecase explicitly\n> allows to test some aspects of case handling even on case sensitive file\n> systems.\n\nThe patch series looks fine to me, but I just wanted to underline the use \nof that \"*some*aspects*\" part.\n\nOn a filesystem that is case sensitive, doing \"core.ignorecase = true\" \ndoesn't magically make git act as if the filesystem was insensitive to \ncase. In particular, since the filesystem very much can contain two \ndifferent versions of a filename in different case, git will actually \nnotice that, and notice that \"CamelCase\" and \"camelcase\" are not \nnecessarily the same file.\n\nTo emulate case insensitivity on filesyststems that are actually \nsensitive, we could do some tests that do things like\n\n\techo Hello > CamelCase\n\tln CamelCase camelcase\n\nand now git will see something that is *closer* to a real case-insensitive \nfilesystem: two names that resolve to the same stat information.\n\nIt's still obviously not identical (because \"readdir()\" will get two \nentries), and as such a test that succeeds in a true case-insensitive \nenvironment will not necessarily work in the above fake kind of situation, \nbut at least you can test some cases.\n\nRenaming the same file to a case that is different is also a worthwhile \nthing to try to \"emulate\" case insensitivity.\n\n\t\t\tLinus\n"}]}