{"thread":{"id":"40181","subject":"[PATCH v6] git-p4: Obey core.ignorecase when using P4 client specs.","startedAt":"2015-08-26T16:08:15Z","lastAt":"2015-08-26T21:48:18Z","messageCount":4,"participants":["larsxschneider@gmail.com","Junio C Hamano","Lars Schneider"],"isPatch":true,"patchVersion":6,"patchTotal":null},"messages":[{"id":"268732","messageId":"1440605295-73844-1-git-send-email-larsxschneider@gmail.com","threadId":"40181","inReplyTo":null,"subject":"[PATCH v6] git-p4: Obey core.ignorecase when using P4 client specs.","fromName":"","fromEmail":"larsxschneider@gmail.com","sentAt":"2015-08-26T16:08:15Z","receivedAt":"2015-08-26T16:08:15Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"From: Lars Schneider <larsxschneider@gmail.com>\n\nWe run P4 servers on Linux and P4 clients on Windows. For an unknown\nreason the file path for a number of files in P4 does not match the\ndirectory path with respect to case sensitivity.\n\nE.g. \"p4 files\" might return\n//depot/path/to/file1\n//depot/pATH/to/file2\n\nIf you use P4/P4V then these files end up in the same directory, e.g.\n//depot/path/to/file1\n//depot/path/to/file2\n\nIf you use git-p4 and clone the code via client spec \"//depot/path/...\"\nthen all files not matching the case in the client spec will be ignored\n(in the example above \"file2\"). This is correct if core.ignorecase=false\nbut not otherwise.\n\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\nAcked-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py                         |   7 ++\n t/t9821-git-p4-path-variations.sh | 200 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 207 insertions(+)\n create mode 100755 t/t9821-git-p4-path-variations.sh\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 073f87b..0093fa3 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1950,10 +1950,14 @@ class View(object):\n             if \"unmap\" in res:\n                 # it will list all of them, but only one not unmap-ped\n                 continue\n+            if gitConfigBool(\"core.ignorecase\"):\n+                res['depotFile'] = res['depotFile'].lower()\n             self.client_spec_path_cache[res['depotFile']] = self.convert_client_path(res[\"clientFile\"])\n \n         # not found files or unmap files set to \"\"\n         for depotFile in fileArgs:\n+            if gitConfigBool(\"core.ignorecase\"):\n+                depotFile = depotFile.lower()\n             if depotFile not in self.client_spec_path_cache:\n                 self.client_spec_path_cache[depotFile] = \"\"\n \n@@ -1962,6 +1966,9 @@ class View(object):\n            depot file should live.  Returns \"\" if the file should\n            not be mapped in the client.\"\"\"\n \n+        if gitConfigBool(\"core.ignorecase\"):\n+            depot_path = depot_path.lower()\n+\n         if depot_path in self.client_spec_path_cache:\n             return self.client_spec_path_cache[depot_path]\n \ndiff --git a/t/t9821-git-p4-path-variations.sh b/t/t9821-git-p4-path-variations.sh\nnew file mode 100755\nindex 0000000..599d16c\n--- /dev/null\n+++ b/t/t9821-git-p4-path-variations.sh\n@@ -0,0 +1,200 @@\n+#!/bin/sh\n+\n+test_description='Clone repositories with path case variations'\n+\n+. ./lib-git-p4.sh\n+\n+test_expect_success 'start p4d with case folding enabled' '\n+\tstart_p4d -C1\n+'\n+\n+test_expect_success 'Create a repo with path case variations' '\n+\tclient_view \"//depot/... //client/...\" &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\n+\t\tmkdir -p One/two &&\n+\t\t>One/two/File2.txt &&\n+\t\tp4 add One/two/File2.txt &&\n+\t\tp4 submit -d \"Add file2\" &&\n+\t\trm -rf One &&\n+\n+\t\tmkdir -p one/TWO &&\n+\t\t>one/TWO/file1.txt &&\n+\t\tp4 add one/TWO/file1.txt &&\n+\t\tp4 submit -d \"Add file1\" &&\n+\t\trm -rf one &&\n+\n+\t\tmkdir -p one/two &&\n+\t\t>one/two/file3.txt &&\n+\t\tp4 add one/two/file3.txt &&\n+\t\tp4 submit -d \"Add file3\" &&\n+\t\trm -rf one &&\n+\n+\t\tmkdir -p outside-spec &&\n+\t\t>outside-spec/file4.txt &&\n+\t\tp4 add outside-spec/file4.txt &&\n+\t\tp4 submit -d \"Add file4\" &&\n+\t\trm -rf outside-spec\n+\t)\n+'\n+\n+test_expect_success 'Clone root' '\n+\tclient_view \"//depot/... //client/...\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase false &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\t# This method is used instead of \"test -f\" to ensure the case is\n+\t\t# checked even if the test is executed on case-insensitive file systems.\n+\t\t# All files are there as expected although the path cases look random.\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOne/two/File2.txt\n+\t\tone/TWO/file1.txt\n+\t\tone/two/file3.txt\n+\t\toutside-spec/file4.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Clone root (ignorecase)' '\n+\tclient_view \"//depot/... //client/...\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase true &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\t# This method is used instead of \"test -f\" to ensure the case is\n+\t\t# checked even if the test is executed on case-insensitive file systems.\n+\t\t# All files are there as expected although the path cases look random.\n+\t\tcat >expect <<-\\EOF &&\n+\t\tone/TWO/File2.txt\n+\t\tone/TWO/file1.txt\n+\t\tone/TWO/file3.txt\n+\t\toutside-spec/file4.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Clone root and ignore one file' '\n+\tclient_view \\\n+\t\t\"//depot/... //client/...\" \\\n+\t\t\"-//depot/one/TWO/file1.txt //client/one/TWO/file1.txt\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase false &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\t# We ignore one file in the client spec and all path cases change from\n+\t\t# \"TWO\" to \"two\"!\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOne/two/File2.txt\n+\t\tone/two/file3.txt\n+\t\toutside-spec/file4.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Clone root and ignore one file (ignorecase)' '\n+\tclient_view \\\n+\t\t\"//depot/... //client/...\" \\\n+\t\t\"-//depot/one/TWO/file1.txt //client/one/TWO/file1.txt\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase true &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\t# We ignore one file in the client spec and all path cases change from\n+\t\t# \"TWO\" to \"two\"!\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOne/two/File2.txt\n+\t\tOne/two/file3.txt\n+\t\toutside-spec/file4.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Clone path' '\n+\tclient_view \"//depot/One/... //client/...\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase false &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\tcat >expect <<-\\EOF &&\n+\t\ttwo/File2.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Clone path (ignorecase)' '\n+\tclient_view \"//depot/One/... //client/...\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase true &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\tcat >expect <<-\\EOF &&\n+\t\tTWO/File2.txt\n+\t\tTWO/file1.txt\n+\t\tTWO/file3.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+# It looks like P4 determines the path case based on the first file in\n+# lexicographical order. Please note the lower case \"two\" directory for all\n+# files triggered through the addition of \"File0.txt\".\n+test_expect_success 'Add a new file and clone path with new file (ignorecase)' '\n+\tclient_view \"//depot/... //client/...\" &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tmkdir -p One/two &&\n+\t\t>One/two/File0.txt &&\n+\t\tp4 add One/two/File0.txt &&\n+\t\tp4 submit -d \"Add file\" &&\n+\t\trm -rf One\n+\t) &&\n+\n+\tclient_view \"//depot/One/... //client/...\" &&\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit init . &&\n+\t\tgit config core.ignorecase true &&\n+\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n+\t\tcat >expect <<-\\EOF &&\n+\t\ttwo/File0.txt\n+\t\ttwo/File2.txt\n+\t\ttwo/file1.txt\n+\t\ttwo/file3.txt\n+\t\tEOF\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'kill p4d' '\n+\tkill_p4d\n+'\n+\n+test_done\n-- \n1.9.5 (Apple Git-50.3)\n"},{"id":"268751","messageId":"xmqqa8td3je7.fsf@gitster.dls.corp.google.com","threadId":"40181","inReplyTo":"1440605295-73844-1-git-send-email-larsxschneider@gmail.com","subject":"Re: [PATCH v6] git-p4: Obey core.ignorecase when using P4 client specs.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-08-26T20:05:36Z","receivedAt":"2015-08-26T20:05:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"larsxschneider@gmail.com writes:\n\n> From: Lars Schneider <larsxschneider@gmail.com>\n>\n> We run P4 servers on Linux and P4 clients on Windows. For an unknown\n> reason the file path for a number of files in P4 does not match the\n> directory path with respect to case sensitivity.\n\nThanks, but is this still \"For an unknown reason\", or during the\ncourse of debugging you found the root cause, which is what led to\nthis fix?\n\n>\n> E.g. \"p4 files\" might return\n> //depot/path/to/file1\n> //depot/pATH/to/file2\n>\n> If you use P4/P4V then these files end up in the same directory, e.g.\n> //depot/path/to/file1\n> //depot/path/to/file2\n>\n> If you use git-p4 and clone the code via client spec \"//depot/path/...\"\n> then all files not matching the case in the client spec will be ignored\n> (in the example above \"file2\"). This is correct if core.ignorecase=false\n> but not otherwise.\n\nThis sentence is hard to grok.  What are you describing?  Solution?\nCurrent problematic behaviour?  Desired behaviour that the patch\nattempts to obtain?\n\nIf I paraphrase it like this, did I understood you correctly?\n\n    The current code always ignores paths in wrong case that do not\n    match client spec.  It is correct to ignore them when\n    core.ignorecase is not set; //depot/path/ and //depot/pATH/ are\n    different things in that case.\n\n    But it is a wrong thing to do if core.ignorecase is set to true.\n    Let's make sure we avoid it by downcasing the depot_path when\n    core.ignorecase is set to true.\n\n\n\n>\n> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n> Acked-by: Luke Diamand <luke@diamand.org>\n> ---\n>  git-p4.py                         |   7 ++\n>  t/t9821-git-p4-path-variations.sh | 200 ++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 207 insertions(+)\n>  create mode 100755 t/t9821-git-p4-path-variations.sh\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 073f87b..0093fa3 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1950,10 +1950,14 @@ class View(object):\n>              if \"unmap\" in res:\n>                  # it will list all of them, but only one not unmap-ped\n>                  continue\n> +            if gitConfigBool(\"core.ignorecase\"):\n> +                res['depotFile'] = res['depotFile'].lower()\n>              self.client_spec_path_cache[res['depotFile']] = self.convert_client_path(res[\"clientFile\"])\n>  \n>          # not found files or unmap files set to \"\"\n>          for depotFile in fileArgs:\n> +            if gitConfigBool(\"core.ignorecase\"):\n> +                depotFile = depotFile.lower()\n>              if depotFile not in self.client_spec_path_cache:\n>                  self.client_spec_path_cache[depotFile] = \"\"\n>  \n> @@ -1962,6 +1966,9 @@ class View(object):\n>             depot file should live.  Returns \"\" if the file should\n>             not be mapped in the client.\"\"\"\n>  \n> +        if gitConfigBool(\"core.ignorecase\"):\n> +            depot_path = depot_path.lower()\n> +\n>          if depot_path in self.client_spec_path_cache:\n>              return self.client_spec_path_cache[depot_path]\n>  \n> diff --git a/t/t9821-git-p4-path-variations.sh b/t/t9821-git-p4-path-variations.sh\n> new file mode 100755\n> index 0000000..599d16c\n> --- /dev/null\n> +++ b/t/t9821-git-p4-path-variations.sh\n> @@ -0,0 +1,200 @@\n> +#!/bin/sh\n> +\n> +test_description='Clone repositories with path case variations'\n> +\n> +. ./lib-git-p4.sh\n> +\n> +test_expect_success 'start p4d with case folding enabled' '\n> +\tstart_p4d -C1\n> +'\n> +\n> +test_expect_success 'Create a repo with path case variations' '\n> +\tclient_view \"//depot/... //client/...\" &&\n> +\t(\n> +\t\tcd \"$cli\" &&\n> +\n> +\t\tmkdir -p One/two &&\n> +\t\t>One/two/File2.txt &&\n> +\t\tp4 add One/two/File2.txt &&\n> +\t\tp4 submit -d \"Add file2\" &&\n> +\t\trm -rf One &&\n> +\n> +\t\tmkdir -p one/TWO &&\n> +\t\t>one/TWO/file1.txt &&\n> +\t\tp4 add one/TWO/file1.txt &&\n> +\t\tp4 submit -d \"Add file1\" &&\n> +\t\trm -rf one &&\n> +\n> +\t\tmkdir -p one/two &&\n> +\t\t>one/two/file3.txt &&\n> +\t\tp4 add one/two/file3.txt &&\n> +\t\tp4 submit -d \"Add file3\" &&\n> +\t\trm -rf one &&\n> +\n> +\t\tmkdir -p outside-spec &&\n> +\t\t>outside-spec/file4.txt &&\n> +\t\tp4 add outside-spec/file4.txt &&\n> +\t\tp4 submit -d \"Add file4\" &&\n> +\t\trm -rf outside-spec\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone root' '\n> +\tclient_view \"//depot/... //client/...\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase false &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\t# This method is used instead of \"test -f\" to ensure the case is\n> +\t\t# checked even if the test is executed on case-insensitive file systems.\n> +\t\t# All files are there as expected although the path cases look random.\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\tOne/two/File2.txt\n> +\t\tone/TWO/file1.txt\n> +\t\tone/two/file3.txt\n> +\t\toutside-spec/file4.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone root (ignorecase)' '\n> +\tclient_view \"//depot/... //client/...\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase true &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\t# This method is used instead of \"test -f\" to ensure the case is\n> +\t\t# checked even if the test is executed on case-insensitive file systems.\n> +\t\t# All files are there as expected although the path cases look random.\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\tone/TWO/File2.txt\n> +\t\tone/TWO/file1.txt\n> +\t\tone/TWO/file3.txt\n> +\t\toutside-spec/file4.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone root and ignore one file' '\n> +\tclient_view \\\n> +\t\t\"//depot/... //client/...\" \\\n> +\t\t\"-//depot/one/TWO/file1.txt //client/one/TWO/file1.txt\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase false &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\t# We ignore one file in the client spec and all path cases change from\n> +\t\t# \"TWO\" to \"two\"!\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\tOne/two/File2.txt\n> +\t\tone/two/file3.txt\n> +\t\toutside-spec/file4.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone root and ignore one file (ignorecase)' '\n> +\tclient_view \\\n> +\t\t\"//depot/... //client/...\" \\\n> +\t\t\"-//depot/one/TWO/file1.txt //client/one/TWO/file1.txt\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase true &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\t# We ignore one file in the client spec and all path cases change from\n> +\t\t# \"TWO\" to \"two\"!\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\tOne/two/File2.txt\n> +\t\tOne/two/file3.txt\n> +\t\toutside-spec/file4.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone path' '\n> +\tclient_view \"//depot/One/... //client/...\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase false &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\ttwo/File2.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'Clone path (ignorecase)' '\n> +\tclient_view \"//depot/One/... //client/...\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase true &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\tTWO/File2.txt\n> +\t\tTWO/file1.txt\n> +\t\tTWO/file3.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +# It looks like P4 determines the path case based on the first file in\n> +# lexicographical order. Please note the lower case \"two\" directory for all\n> +# files triggered through the addition of \"File0.txt\".\n> +test_expect_success 'Add a new file and clone path with new file (ignorecase)' '\n> +\tclient_view \"//depot/... //client/...\" &&\n> +\t(\n> +\t\tcd \"$cli\" &&\n> +\t\tmkdir -p One/two &&\n> +\t\t>One/two/File0.txt &&\n> +\t\tp4 add One/two/File0.txt &&\n> +\t\tp4 submit -d \"Add file\" &&\n> +\t\trm -rf One\n> +\t) &&\n> +\n> +\tclient_view \"//depot/One/... //client/...\" &&\n> +\ttest_when_finished cleanup_git &&\n> +\t(\n> +\t\tcd \"$git\" &&\n> +\t\tgit init . &&\n> +\t\tgit config core.ignorecase true &&\n> +\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n> +\t\tcat >expect <<-\\EOF &&\n> +\t\ttwo/File0.txt\n> +\t\ttwo/File2.txt\n> +\t\ttwo/file1.txt\n> +\t\ttwo/file3.txt\n> +\t\tEOF\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n> +test_expect_success 'kill p4d' '\n> +\tkill_p4d\n> +'\n> +\n> +test_done\n"},{"id":"268759","messageId":"4CB47914-F04C-4E88-8D73-E00AFEFEF727@gmail.com","threadId":"40181","inReplyTo":"xmqqa8td3je7.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v6] git-p4: Obey core.ignorecase when using P4 client specs.","fromName":"Lars Schneider","fromEmail":"larsxschneider@gmail.com","sentAt":"2015-08-26T21:25:47Z","receivedAt":"2015-08-26T21:25:47Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"\nOn 26 Aug 2015, at 22:05, Junio C Hamano <gitster@pobox.com> wrote:\n\n> larsxschneider@gmail.com writes:\n> \n>> From: Lars Schneider <larsxschneider@gmail.com>\n>> \n>> We run P4 servers on Linux and P4 clients on Windows. For an unknown\n>> reason the file path for a number of files in P4 does not match the\n>> directory path with respect to case sensitivity.\n> \n> Thanks, but is this still \"For an unknown reason\", or during the\n> course of debugging you found the root cause, which is what led to\n> this fix?\nWe are migrating away from P4 and therefore I haven’t debugged the root cause. The source of this problem is 100% P4 related. No Git involvement at all. Maybe I just remove this paragraph?\n\n\n> \n>> \n>> E.g. \"p4 files\" might return\n>> //depot/path/to/file1\n>> //depot/pATH/to/file2\n>> \n>> If you use P4/P4V then these files end up in the same directory, e.g.\n>> //depot/path/to/file1\n>> //depot/path/to/file2\n>> \n>> If you use git-p4 and clone the code via client spec \"//depot/path/...\"\n>> then all files not matching the case in the client spec will be ignored\n>> (in the example above \"file2\"). This is correct if core.ignorecase=false\n>> but not otherwise.\n> \n> This sentence is hard to grok.  What are you describing?  Solution?\n> Current problematic behaviour?  Desired behaviour that the patch\n> attempts to obtain?\nI tried to describe the situation that causes the strange behavior.\n\n> \n> If I paraphrase it like this, did I understood you correctly?\n> \n>    The current code always ignores paths in wrong case that do not\n>    match client spec.  It is correct to ignore them when\n>    core.ignorecase is not set; //depot/path/ and //depot/pATH/ are\n>    different things in that case.\n> \n>    But it is a wrong thing to do if core.ignorecase is set to true.\n>    Let's make sure we avoid it by downcasing the depot_path when\n>    core.ignorecase is set to true.\n\nHow about this:\n\n-----------------\nThe current code always ignores files with paths that do not match the case of the paths defined in the client spec. This commit changes this behavior and obeys these files if “core.ignorecase” is set to \"true”.\n\nExample:\nA P4 repository contains the following files:\n//depot/path/to/file1\n//depot/pATH/to/file2\n\nThe P4 repository is cloned with git-p4 and the following client spec view:\n//depot/path/… //client/...\n\nThe cloned Git repository will contain only the following file:\nto/file1\n\n“file2” is not present in the cloned Git repository. If “core.ignorecase\" is set to “true” then path case sensitivity is ignored and “file2” will be present.\n————————\n\nThanks,\nLars\n"},{"id":"268760","messageId":"xmqqsi75202l.fsf@gitster.dls.corp.google.com","threadId":"40181","inReplyTo":"4CB47914-F04C-4E88-8D73-E00AFEFEF727@gmail.com","subject":"Re: [PATCH v6] git-p4: Obey core.ignorecase when using P4 client specs.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-08-26T21:48:18Z","receivedAt":"2015-08-26T21:48:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Schneider <larsxschneider@gmail.com> writes:\n\n> On 26 Aug 2015, at 22:05, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> larsxschneider@gmail.com writes:\n>> \n>>> From: Lars Schneider <larsxschneider@gmail.com>\n>>> \n>>> We run P4 servers on Linux and P4 clients on Windows. For an unknown\n>>> reason the file path for a number of files in P4 does not match the\n>>> directory path with respect to case sensitivity.\n>> \n>> Thanks, but is this still \"For an unknown reason\", or during the\n>> course of debugging you found the root cause, which is what led to\n>> this fix?\n> We are migrating away from P4 and therefore I haven’t debugged the\n> root cause. The source of this problem is 100% P4 related. No Git\n> involvement at all. Maybe I just remove this paragraph?\n\nPerhaps.  If it is irrelevant how the P4 depot ended up recording\nthe paths in mixed cases, then we can just say that as a prerequiste\ncondition to trigger the problem.\n\nPerhaps rephrase the entire thing like this?\n\n    Perforce depot may record paths in mixed cases, e.g. \"p4 files\" may\n    show that there are these two paths:\n\n        //depot/path/to/file1\n        //depot/pATH/to/file2\n\n    and with \"p4\" or \"p4v\", these end up in the same directory, e.g.\n\n        //depot/path/to/file1\n        //depot/path/to/file2\n\n    which is the desired outcome on case insensitive systems.\n\n    If git-p4 is used with client spec \"//depot/path/...\", however, then\n    all files not matching the case in the client spec are ignored (in\n    the example above \"//depot/pATH/to/file2\").\n\n    Fix this by downcasing the depot_path when core.ignorcase is set to\n    true.\n\nThanks.\n"}]}