{"thread":{"id":"34743","subject":"t3010 broken by 2eac2a4","startedAt":"2013-08-21T20:31:56Z","lastAt":"2013-08-23T18:51:58Z","messageCount":17,"participants":["Brian Gernhardt","Junio C Hamano","Eric Sunshine","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"225638","messageId":"82078845-3AB9-4B36-9130-039CC33C8A7A@gernhardtsoftware.com","threadId":"34743","inReplyTo":null,"subject":"t3010 broken by 2eac2a4","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2013-08-21T20:31:56Z","receivedAt":"2013-08-21T20:31:56Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"With 2eac2a4: \"ls-files -k: a directory only can be killed if the index has a non-directory\" applied, t3010 fails test 3 \"validate git ls-files -k output\".  It ends up missing the pathx/ju/nk file.\n\nOS X 10.8.4\nXcode 4.6.3\nclang \"Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)\" \n\n~~ Brian Gernhardt\n"},{"id":"225649","messageId":"xmqqbo4qu3g4.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"82078845-3AB9-4B36-9130-039CC33C8A7A@gernhardtsoftware.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-21T21:41:31Z","receivedAt":"2013-08-21T21:41:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brian Gernhardt <brian@gernhardtsoftware.com> writes:\n\n> With 2eac2a4: \"ls-files -k: a directory only can be killed if the index has a non-directory\" applied, t3010 fails test 3 \"validate git ls-files -k output\".  It ends up missing the pathx/ju/nk file.\n>\n> OS X 10.8.4\n> Xcode 4.6.3\n> clang \"Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)\" \n\nVery interesting, as it obviously does not reproduce for me.\n"},{"id":"225686","messageId":"CAPig+cQHTvmTWvGfg1Z3KfBrPD+QbSEbYBYz6XWT3KKu3-+jyQ@mail.gmail.com","threadId":"34743","inReplyTo":"xmqqbo4qu3g4.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T20:54:10Z","receivedAt":"2013-08-22T20:54:10Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Aug 21, 2013 at 5:41 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Brian Gernhardt <brian@gernhardtsoftware.com> writes:\n>\n>> With 2eac2a4: \"ls-files -k: a directory only can be killed if the index has a non-directory\" applied, t3010 fails test 3 \"validate git ls-files -k output\".  It ends up missing the pathx/ju/nk file.\n>>\n>> OS X 10.8.4\n>> Xcode 4.6.3\n>> clang \"Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)\"\n>\n> Very interesting, as it obviously does not reproduce for me.\n\nI can confirm this failure on OS X, however, I am somewhat confused by\nthe follow-up t3010 changes in 3c56875176390eee. Are the t3010 changes\nsupposed to fail without 2eac2a4cc4bdc8d7 applied? For me, on Linux,\nthe tests succeed whether 2eac2a4cc4bdc8d7 is applied or not. On OS X,\nthe tests succeed without 2eac2a4cc4bdc8d7 but fail with it applied.\n"},{"id":"225689","messageId":"xmqqbo4pqvde.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"CAPig+cQHTvmTWvGfg1Z3KfBrPD+QbSEbYBYz6XWT3KKu3-+jyQ@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-22T21:16:29Z","receivedAt":"2013-08-22T21:16:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> I can confirm this failure on OS X, however, I am somewhat confused by\n> the follow-up t3010 changes in 3c56875176390eee. Are the t3010 changes\n> supposed to fail without 2eac2a4cc4bdc8d7 applied? For me, on Linux,\n> the tests succeed whether 2eac2a4cc4bdc8d7 is applied or not. On OS X,\n> the tests succeed without 2eac2a4cc4bdc8d7 but fail with it applied.\n\nThe 2eac2a4c (ls-files -k: a directory only can be killed if the\nindex has a non-directory, 2013-08-15) is NOT a correctness fix.\n\nIt is an optimization to avoid scanning directories that are known\nnot to be killed when \"ls-files -k\" is asked to list killed\npaths. The original code without the patch is correct already; it\njust is too inefficient because it scans all the directories.  It is\nnot surprising if the test added by 3c568751 (t3010: update to\ndemonstrate \"ls-files -k\" optimization pitfalls, 2013-08-15) passes\nwithout 2eac2a4c.\n\nAs its log message explains, 3c568751 (t3010: update to demonstrate\n\"ls-files -k\" optimization pitfalls, 2013-08-15) is to catch a case\nwhere an earlier \"something like this\" patch (which is the draft for\n2eac2a4c) posted to the list would have broken.  That draft patch\nwas correct only for the case where the top-level directory is\nkilled, but was broken when a subdirectory (e.g. pathx/ju) is\nkilled.\n"},{"id":"225690","messageId":"CAPig+cQmvRDDc3BHbta_UhCQe9QvbtAm0RJgt6HbtgFAKgo0Vg@mail.gmail.com","threadId":"34743","inReplyTo":"xmqqbo4pqvde.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T21:22:30Z","receivedAt":"2013-08-22T21:22:30Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 5:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n>> I can confirm this failure on OS X, however, I am somewhat confused by\n>> the follow-up t3010 changes in 3c56875176390eee. Are the t3010 changes\n>> supposed to fail without 2eac2a4cc4bdc8d7 applied? For me, on Linux,\n>> the tests succeed whether 2eac2a4cc4bdc8d7 is applied or not. On OS X,\n>> the tests succeed without 2eac2a4cc4bdc8d7 but fail with it applied.\n>\n> The 2eac2a4c (ls-files -k: a directory only can be killed if the\n> index has a non-directory, 2013-08-15) is NOT a correctness fix.\n>\n> It is an optimization to avoid scanning directories that are known\n> not to be killed when \"ls-files -k\" is asked to list killed\n> paths. The original code without the patch is correct already; it\n> just is too inefficient because it scans all the directories.  It is\n> not surprising if the test added by 3c568751 (t3010: update to\n> demonstrate \"ls-files -k\" optimization pitfalls, 2013-08-15) passes\n> without 2eac2a4c.\n>\n> As its log message explains, 3c568751 (t3010: update to demonstrate\n> \"ls-files -k\" optimization pitfalls, 2013-08-15) is to catch a case\n> where an earlier \"something like this\" patch (which is the draft for\n> 2eac2a4c) posted to the list would have broken.  That draft patch\n> was correct only for the case where the top-level directory is\n> killed, but was broken when a subdirectory (e.g. pathx/ju) is\n> killed.\n\nThanks for the explanation.\n"},{"id":"225691","messageId":"xmqq7gfdqumd.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"CAPig+cQmvRDDc3BHbta_UhCQe9QvbtAm0RJgt6HbtgFAKgo0Vg@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-22T21:32:42Z","receivedAt":"2013-08-22T21:32:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Thu, Aug 22, 2013 at 5:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>\n>>> I can confirm this failure on OS X, however,...\n>\n> Thanks for the explanation.\n\nNow, I am curious how it breaks on OS X.\n\nMy suspition is that \"ignore_case\" may have something to do with it,\nbut what 2eac2a4c (ls-files -k: a directory only can be killed if\nthe index has a non-directory, 2013-08-15) uses are the bog-standard\ncache_name_exists() and directory_exists_in_index(), so one of these\ninternal API implementation has trouble on case insensitive\nfilesystems, perhaps?  I dunno.\n"},{"id":"225692","messageId":"CAPig+cSEQLk2M+X5QP7mkm846wqqHRCjPHgO7O3URvNcsYO6+w@mail.gmail.com","threadId":"34743","inReplyTo":"xmqq7gfdqumd.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T21:35:19Z","receivedAt":"2013-08-22T21:35:19Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 5:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n>> On Thu, Aug 22, 2013 at 5:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>>\n>>>> I can confirm this failure on OS X, however,...\n>>\n>> Thanks for the explanation.\n>\n> Now, I am curious how it breaks on OS X.\n>\n> My suspition is that \"ignore_case\" may have something to do with it,\n> but what 2eac2a4c (ls-files -k: a directory only can be killed if\n> the index has a non-directory, 2013-08-15) uses are the bog-standard\n> cache_name_exists() and directory_exists_in_index(), so one of these\n> internal API implementation has trouble on case insensitive\n> filesystems, perhaps?  I dunno.\n\nThat's exactly my suspicion at the moment. It's an obvious difference\nbetween Linux and OS X. I'm just in the process of trying to compare\nbetween the two platforms.\n"},{"id":"225693","messageId":"xmqq38q1qu3l.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"CAPig+cSEQLk2M+X5QP7mkm846wqqHRCjPHgO7O3URvNcsYO6+w@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-22T21:43:58Z","receivedAt":"2013-08-22T21:43:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Thu, Aug 22, 2013 at 5:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>\n>>> On Thu, Aug 22, 2013 at 5:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>>>\n>>>>> I can confirm this failure on OS X, however,...\n>>>\n>>> Thanks for the explanation.\n>>\n>> Now, I am curious how it breaks on OS X.\n>>\n>> My suspition is that \"ignore_case\" may have something to do with it,\n>> but what 2eac2a4c (ls-files -k: a directory only can be killed if\n>> the index has a non-directory, 2013-08-15) uses are the bog-standard\n>> cache_name_exists() and directory_exists_in_index(), so one of these\n>> internal API implementation has trouble on case insensitive\n>> filesystems, perhaps?  I dunno.\n>\n> That's exactly my suspicion at the moment. It's an obvious difference\n> between Linux and OS X. I'm just in the process of trying to compare\n> between the two platforms.\n\nOr perhaps de->d_type does not exist?  In such a case, we end up\ndoing get_index_dtype() via get_dtype(), but in this codepath I\nsuspect that we do not want to.  We are interested in the type of\nthe entity on the filesystem.\n"},{"id":"225694","messageId":"CAPig+cSgM-kO0Mk9qbGfLR8DZkYQt60Va4N2wfRBVqmReTPowQ@mail.gmail.com","threadId":"34743","inReplyTo":"xmqq38q1qu3l.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T21:59:28Z","receivedAt":"2013-08-22T21:59:28Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 5:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>> On Thu, Aug 22, 2013 at 5:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Now, I am curious how it breaks on OS X.\n>>>\n>>> My suspition is that \"ignore_case\" may have something to do with it,\n>>> but what 2eac2a4c (ls-files -k: a directory only can be killed if\n>>> the index has a non-directory, 2013-08-15) uses are the bog-standard\n>>> cache_name_exists() and directory_exists_in_index(), so one of these\n>>> internal API implementation has trouble on case insensitive\n>>> filesystems, perhaps?  I dunno.\n>>\n>> That's exactly my suspicion at the moment. It's an obvious difference\n>> between Linux and OS X. I'm just in the process of trying to compare\n>> between the two platforms.\n>\n> Or perhaps de->d_type does not exist?  In such a case, we end up\n> doing get_index_dtype() via get_dtype(), but in this codepath I\n> suspect that we do not want to.  We are interested in the type of\n> the entity on the filesystem.\n\nde->d_type exists on both platforms. get_dtype() is never called.\n\nHowever, I did discover that treat_path() is being invoked fewer times\non OSX than on Linux. For instance, in the repository created by\nt3010, treat_path() is called 19 times on Linux, but only 17 times on\nOSX.\n"},{"id":"225695","messageId":"CAPig+cQ15Qq7pJ0sLmnuQt_EERn9fkzCa-Gr-pb6a_zf1MLcGQ@mail.gmail.com","threadId":"34743","inReplyTo":"CAPig+cSgM-kO0Mk9qbGfLR8DZkYQt60Va4N2wfRBVqmReTPowQ@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T22:53:07Z","receivedAt":"2013-08-22T22:53:07Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 5:59 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Thu, Aug 22, 2013 at 5:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>> On Thu, Aug 22, 2013 at 5:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>>> Now, I am curious how it breaks on OS X.\n>>>>\n>>>> My suspition is that \"ignore_case\" may have something to do with it,\n>>>> but what 2eac2a4c (ls-files -k: a directory only can be killed if\n>>>> the index has a non-directory, 2013-08-15) uses are the bog-standard\n>>>> cache_name_exists() and directory_exists_in_index(), so one of these\n>>>> internal API implementation has trouble on case insensitive\n>>>> filesystems, perhaps?  I dunno.\n>>>\n>>> That's exactly my suspicion at the moment. It's an obvious difference\n>>> between Linux and OS X. I'm just in the process of trying to compare\n>>> between the two platforms.\n>>\n>> Or perhaps de->d_type does not exist?  In such a case, we end up\n>> doing get_index_dtype() via get_dtype(), but in this codepath I\n>> suspect that we do not want to.  We are interested in the type of\n>> the entity on the filesystem.\n>\n> de->d_type exists on both platforms. get_dtype() is never called.\n>\n> However, I did discover that treat_path() is being invoked fewer times\n> on OSX than on Linux. For instance, in the repository created by\n> t3010, treat_path() is called 19 times on Linux, but only 17 times on\n> OSX.\n\nStatus update: For the 'pathx' directory created by the t3010 test,\ndirectory_exists_in_index() returns false on OSX, but true is returned\non Linux.\n"},{"id":"225697","messageId":"xmqqwqndpbfc.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"CAPig+cQ15Qq7pJ0sLmnuQt_EERn9fkzCa-Gr-pb6a_zf1MLcGQ@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-22T23:12:39Z","receivedAt":"2013-08-22T23:12:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> Status update: For the 'pathx' directory created by the t3010 test,\n> directory_exists_in_index() returns false on OSX, but true is returned\n> on Linux.\n\nBecause a regular pathx/ju is in the index at that point, the\ncorrect answer directory_exists_in_index() should give for 'pathx'\nis \"index_directory\", not \"index_nonexistent\", I think.\n"},{"id":"225702","messageId":"CAPig+cSqtMOYvxbvXstm9nqQD9sQ378NKCHSK7Ec6GrK5VJiGA@mail.gmail.com","threadId":"34743","inReplyTo":"xmqqwqndpbfc.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-22T23:15:27Z","receivedAt":"2013-08-22T23:15:27Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 7:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n>> Status update: For the 'pathx' directory created by the t3010 test,\n>> directory_exists_in_index() returns false on OSX, but true is returned\n>> on Linux.\n>\n> Because a regular pathx/ju is in the index at that point, the\n> correct answer directory_exists_in_index() should give for 'pathx'\n> is \"index_directory\", not \"index_nonexistent\", I think.\n\ndirectory_exists_in_index() and directory_exists_in_index_icase() are\nbehaving differently. You can replicate the problem on Linux by\nenabling core.ignorecase in the test (sans gmail whitespace damage):\n\n-->8--\ndiff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modif\nindex 3120efd..8c76160 100755\n--- a/t/t3010-ls-files-killed-modified.sh\n+++ b/t/t3010-ls-files-killed-modified.sh\n@@ -89,7 +89,7 @@ test_expect_success 'git ls-files -k to show killed files.' '\n        : >path9 &&\n        touch path10 &&\n        >pathx/ju/nk &&\n-       git ls-files -k >.output\n+       git -c core.ignorecase=true ls-files -k >.output\n '\n-->8--\n"},{"id":"225710","messageId":"CAPig+cR0Z0gghUH5C6+XCuGQ3gz5JoWrnObVbbA5_ahPmC8G2Q@mail.gmail.com","threadId":"34743","inReplyTo":"CAPig+cSqtMOYvxbvXstm9nqQD9sQ378NKCHSK7Ec6GrK5VJiGA@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-23T04:32:26Z","receivedAt":"2013-08-23T04:32:26Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 22, 2013 at 7:15 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Thu, Aug 22, 2013 at 7:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>\n>>> Status update: For the 'pathx' directory created by the t3010 test,\n>>> directory_exists_in_index() returns false on OSX, but true is returned\n>>> on Linux.\n>>\n>> Because a regular pathx/ju is in the index at that point, the\n>> correct answer directory_exists_in_index() should give for 'pathx'\n>> is \"index_directory\", not \"index_nonexistent\", I think.\n>\n> directory_exists_in_index() and directory_exists_in_index_icase() are\n> behaving differently. You can replicate the problem on Linux by\n> enabling core.ignorecase in the test (sans gmail whitespace damage):\n>\n> -->8--\n> diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modif\n> index 3120efd..8c76160 100755\n> --- a/t/t3010-ls-files-killed-modified.sh\n> +++ b/t/t3010-ls-files-killed-modified.sh\n> @@ -89,7 +89,7 @@ test_expect_success 'git ls-files -k to show killed files.' '\n>         : >path9 &&\n>         touch path10 &&\n>         >pathx/ju/nk &&\n> -       git ls-files -k >.output\n> +       git -c core.ignorecase=true ls-files -k >.output\n>  '\n> -->8--\n\nI sent a patch [1] which resolves the problem, although the solution\nis not especially pretty (due to some ugliness in the existing\nimplementation).\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/232796\n"},{"id":"225711","messageId":"7vsiy1j7dd.fsf@alter.siamese.dyndns.org","threadId":"34743","inReplyTo":"CAPig+cR0Z0gghUH5C6+XCuGQ3gz5JoWrnObVbbA5_ahPmC8G2Q@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-23T05:36:46Z","receivedAt":"2013-08-23T05:36:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> I sent a patch [1] which resolves the problem, although the solution\n> is not especially pretty (due to some ugliness in the existing\n> implementation).\n\nYeah, thanks.\n\nI tend to agree with you that fixing the \"icase\" callee not to rely\non having the trailing slash (which is looking past the end of the\ngiven string), instead of working that breakage around on the\ncaller's side like your patch did, would be a better alternative,\nthough.\n"},{"id":"225715","messageId":"CAPig+cRumXHk-30yvS8Q2xvOxA0qEEXaD7=iJo_X26HL-YRRJg@mail.gmail.com","threadId":"34743","inReplyTo":"7vsiy1j7dd.fsf@alter.siamese.dyndns.org","subject":"Re: t3010 broken by 2eac2a4","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-23T09:19:52Z","receivedAt":"2013-08-23T09:19:52Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Aug 23, 2013 at 1:36 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n>> I sent a patch [1] which resolves the problem, although the solution\n>> is not especially pretty (due to some ugliness in the existing\n>> implementation).\n>\n> Yeah, thanks.\n>\n> I tend to agree with you that fixing the \"icase\" callee not to rely\n> on having the trailing slash (which is looking past the end of the\n> given string), instead of working that breakage around on the\n> caller's side like your patch did, would be a better alternative,\n> though.\n\nMy concern with fixing directory_exists_in_index_icase() to add the\n'/' itself was that it would have to copy the string to make space for\nthe '/', which could be expensive. However, I reworked the code so\nthat the existing strbufs now get passed to\ndirectory_exists_in_index_icase(), which allows it to add its needed\n'/' without duplicating the string. So, the trailing '/' requirement\nof directory_exists_in_index_icase() is now a private implementation\ndetail, placing no burden on the caller.\n\nI'll send the revised patch series later today since the commit\nmessage needs a rewrite. Also, I'd like to try to split the change\ninto a couple patches -- one to pass around strbufs, which has a noisy\ndiff, and one to fix the actual bug -- though I fear that splitting\nmay not be possible.\n"},{"id":"225723","messageId":"xmqqk3jcpbuc.fsf@gitster.dls.corp.google.com","threadId":"34743","inReplyTo":"CAPig+cRumXHk-30yvS8Q2xvOxA0qEEXaD7=iJo_X26HL-YRRJg@mail.gmail.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-23T17:15:55Z","receivedAt":"2013-08-23T17:15:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Fri, Aug 23, 2013 at 1:36 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Sunshine <sunshine@sunshineco.com> writes:\n>>\n>>> I sent a patch [1] which resolves the problem, although the solution\n>>> is not especially pretty (due to some ugliness in the existing\n>>> implementation).\n>>\n>> Yeah, thanks.\n>>\n>> I tend to agree with you that fixing the \"icase\" callee not to rely\n>> on having the trailing slash (which is looking past the end of the\n>> given string), instead of working that breakage around on the\n>> caller's side like your patch did, would be a better alternative,\n>> though.\n>\n> My concern with fixing directory_exists_in_index_icase() to add the\n> '/' itself was that it would have to copy the string to make space for\n> the '/', which could be expensive. However, I reworked the code so\n> that the existing strbufs now get passed to\n> directory_exists_in_index_icase(), which allows it to add its needed\n> '/' without duplicating the string. So, the trailing '/' requirement\n> of directory_exists_in_index_icase() is now a private implementation\n> detail, placing no burden on the caller.\n\nWhen 5102c617 (Add case insensitivity support for directories when\nusing git status, 2010-10-03) added the directories to the name-hash\nwith trailing slash, there was only a single name hash table to\nwhich both real cache entries and leading directory prefixes are\nregistered, so it made some sense to register them with trailing\nslashes so that we can tell what kind of entry is being returned.\n\nBut since 2092678c (name-hash.c: fix endless loop with\ncore.ignorecase=true, 2013-02-28), these directory entries that are\nnot the cache entries are kept track of in a separate hashtable,\nwhich makes me wonder if it still makes sense to register\ndirectories with trailing slashes.\n\nAnd if we stop doing that (and instead if we shrunk the namelen when\nan unconverted caller asks for a name with a trailing slash to see\nif a directory exists in the index), wouldn't it automatically fix\nthe directory_exists_in_index_icase()?  It does not need to assume\nthat dirname[len] has '/'; after all, it may not even be a valid\nmemory location in the first place.\n"},{"id":"225732","messageId":"20130823185158.GC30130@sigill.intra.peff.net","threadId":"34743","inReplyTo":"xmqqk3jcpbuc.fsf@gitster.dls.corp.google.com","subject":"Re: t3010 broken by 2eac2a4","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-08-23T18:51:58Z","receivedAt":"2013-08-23T18:51:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 23, 2013 at 10:15:55AM -0700, Junio C Hamano wrote:\n\n> When 5102c617 (Add case insensitivity support for directories when\n> using git status, 2010-10-03) added the directories to the name-hash\n> with trailing slash, there was only a single name hash table to\n> which both real cache entries and leading directory prefixes are\n> registered, so it made some sense to register them with trailing\n> slashes so that we can tell what kind of entry is being returned.\n> \n> But since 2092678c (name-hash.c: fix endless loop with\n> core.ignorecase=true, 2013-02-28), these directory entries that are\n> not the cache entries are kept track of in a separate hashtable,\n> which makes me wonder if it still makes sense to register\n> directories with trailing slashes.\n> \n> And if we stop doing that (and instead if we shrunk the namelen when\n> an unconverted caller asks for a name with a trailing slash to see\n> if a directory exists in the index), wouldn't it automatically fix\n> the directory_exists_in_index_icase()?  It does not need to assume\n> that dirname[len] has '/'; after all, it may not even be a valid\n> memory location in the first place.\n\nYeah, I think that is sane overall direction. When I did the sketch that\neventually turned into Karsten's 2092678c, that was one of the goals.\nBut I did not keep up with his response and the final patch, and I'm not\nsure if the slashes still serve some function. So it would definitely\nneed somebody looking carefully at the current logic.\n\nMore details are in this sub-thread:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/215820/focus=216284\n\n-Peff\n"}]}