{"thread":{"id":"15410","subject":"[RFC/PATCH] Use compatibility regex library for OSX/Darwin","startedAt":"2008-09-07T18:45:37Z","lastAt":"2008-09-19T18:14:51Z","messageCount":44,"participants":["Arjen Laarhoven","Mike Ralphson","Johannes Sixt","Junio C Hamano","Jeff King","Brandon Casey","Boyd Lynn Gerber","Andreas Ericsson","Johan Herland","Gustaf Hendeby","Jonathan del Strother"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"89995","messageId":"20080907184537.GA4148@regex.yaph.org","threadId":"15410","inReplyTo":null,"subject":"[RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2008-09-07T18:45:37Z","receivedAt":"2008-09-07T18:45:37Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"The standard libc regex library on OSX does not support alternation\nin POSIX Basic Regular Expression mode.  This breaks the diff.funcname\nfunctionality on OSX.\n\nTo fix this, we use the GNU regex library which is already present in\nthe compat/ diretory for the MinGW port.  However, simply adding compat/\nto the COMPAT_CFLAGS variable causes a conflict between the system\nfnmatch.h and the one present in compat/.  To remedy this, move the\nregex and fnmatch functionality to their own subdirectories in compat/\nso they can be included seperately.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\nThis patch is based on 'maint'.  It needs testing on MinGW (although\nthe change is trivial).\n\nAlso, I'm sure the problem occurs on more non-Linux systems (or non\nGNU libc systems).  If people who have access to those systems (BSD's,\nHP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\npatch so it can fix for multiple systems at once.\n\n Makefile                       |    6 ++++--\n compat/{ => fnmatch}/fnmatch.c |    0\n compat/{ => fnmatch}/fnmatch.h |    0\n compat/{ => regex}/regex.c     |    0\n compat/{ => regex}/regex.h     |    0\n t/t4018-diff-funcname.sh       |    6 ++++++\n 6 files changed, 10 insertions(+), 2 deletions(-)\n rename compat/{ => fnmatch}/fnmatch.c (100%)\n rename compat/{ => fnmatch}/fnmatch.h (100%)\n rename compat/{ => regex}/regex.c (100%)\n rename compat/{ => regex}/regex.h (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 672ea74..a8b3f9e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -626,6 +626,8 @@ ifeq ($(uname_S),Darwin)\n \tendif\n \tNO_STRLCPY = YesPlease\n \tNO_MEMMEM = YesPlease\n+\tCOMPAT_CFLAGS += -Icompat/regex\n+\tCOMPAT_OBJS += compat/regex/regex.o\n endif\n ifeq ($(uname_S),SunOS)\n \tNEEDS_SOCKET = YesPlease\n@@ -750,10 +752,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_SVN_TESTS = YesPlease\n \tNO_PERL_MAKEMAKER = YesPlease\n \tNO_POSIX_ONLY_PROGRAMS = YesPlease\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch\n \tCOMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n-\tCOMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o\n+\tCOMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o\n \tEXTLIBS += -lws2_32\n \tX = .exe\n \tgitexecdir = ../libexec/git-core\ndiff --git a/compat/fnmatch.c b/compat/fnmatch/fnmatch.c\nsimilarity index 100%\nrename from compat/fnmatch.c\nrename to compat/fnmatch/fnmatch.c\ndiff --git a/compat/fnmatch.h b/compat/fnmatch/fnmatch.h\nsimilarity index 100%\nrename from compat/fnmatch.h\nrename to compat/fnmatch/fnmatch.h\ndiff --git a/compat/regex.c b/compat/regex/regex.c\nsimilarity index 100%\nrename from compat/regex.c\nrename to compat/regex/regex.c\ndiff --git a/compat/regex.h b/compat/regex/regex.h\nsimilarity index 100%\nrename from compat/regex.h\nrename to compat/regex/regex.h\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 833d6cb..18bcd97 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' '\n \ttest_must_fail git diff --no-index Beer.java Beer-correct.java\n '\n \n+test_expect_success 'alternation in pattern' '\n+\tgit config diff.java.funcname \"^[ \t]*\\\\(\\\\(public\\\\|static\\\\).*\\\\)$\"\n+\tgit diff --no-index Beer.java Beer-correct.java |\n+\tgrep \"^@@.*@@ public static void main(\"\n+'\n+\n test_done\n-- \n1.6.0.1.337.g5c7d67\n"},{"id":"90325","messageId":"e2b179460809100103t4266650bnac00097cfb86c0b1@mail.gmail.com","threadId":"15410","inReplyTo":"20080907184537.GA4148@regex.yaph.org","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-09-10T08:03:05Z","receivedAt":"2008-09-10T08:03:05Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/9/7 Arjen Laarhoven <arjen@yaph.org>\n> The standard libc regex library on OSX does not support alternation\n> in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n> functionality on OSX.\n>\n> Also, I'm sure the problem occurs on more non-Linux systems (or non\n> GNU libc systems).  If people who have access to those systems (BSD's,\n> HP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\n> patch so it can fix for multiple systems at once.\n\nI can confirm that the issue shown up by your new testcase is also\npresent in AIX 5.3.\n\nDoing the mv's and adding regex.o to COMPAT_OBJS works fine and\ncompat/lib.a is suitably amended\n\nar -t compat/lib.a\nregex.o\n...\n\nbut I'm afraid I don't know how to get the combination of gcc + AIX ld\nto link to this in preference to the system defined regex functions.\nAt least I guess this is what's happening.\n\nAdding -lcompat/regex to COMPAT_CFLAGS as per your Darwin hunk\nprovokes lots of warnings:\n\ngcc: -lcompat/regex: linker input file unused because linking not done\n... (\" for each .c file)\n    LINK git-fast-import\ncollect2: library libcompat/regex not found\n\nThat said, I'm not specifically arguing in favour of the patch (I\nwouldn't know a regex alternation if it bit me), someone writing\nregexs on HP-UX might expect them to work like the rest of their OS...\n\nIf the shipped java funcname pattern requires alternation then the\ntestcase should stand though.\n\nMike\n"},{"id":"90336","messageId":"48C7983B.8010308@viscovery.net","threadId":"15410","inReplyTo":"e2b179460809100103t4266650bnac00097cfb86c0b1@mail.gmail.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-10T09:49:47Z","receivedAt":"2008-09-10T09:49:47Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Mike Ralphson schrieb:\n> 2008/9/7 Arjen Laarhoven <arjen@yaph.org>\n>> The standard libc regex library on OSX does not support alternation\n>> in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n>> functionality on OSX.\n>>\n>> Also, I'm sure the problem occurs on more non-Linux systems (or non\n>> GNU libc systems).  If people who have access to those systems (BSD's,\n>> HP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\n>> patch so it can fix for multiple systems at once.\n\nThe MinGW part of this patch works just fine:\n\nTested-by: Johannes Sixt <johannes.sixt@telecom.at>\n\n> I can confirm that the issue shown up by your new testcase is also\n> present in AIX 5.3.\n...\n> but I'm afraid I don't know how to get the combination of gcc + AIX ld\n> to link to this in preference to the system defined regex functions.\n\nDoes this patchlet help? It gives no warnings or errors on my AIX 4.3.3\nbox and passes the new test (which fails without this).\n\ndiff --git a/Makefile b/Makefile\nindex 98d67f1..0637419 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -702,6 +702,8 @@ ifeq ($(uname_S),AIX)\n \tINTERNAL_QSORT = UnfortunatelyYes\n \tNEEDS_LIBICONV=YesPlease\n \tBASIC_CFLAGS += -D_LARGE_FILES\n+\tCOMPAT_CFLAGS += -Icompat/regex\n+\tCOMPAT_OBJS += compat/regex/regex.o\n endif\n ifeq ($(uname_S),GNU)\n \t# GNU/Hurd\n"},{"id":"90339","messageId":"20080910100301.GA27748@regex.yaph.org","threadId":"15410","inReplyTo":"e2b179460809100103t4266650bnac00097cfb86c0b1@mail.gmail.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2008-09-10T10:03:01Z","receivedAt":"2008-09-10T10:03:01Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"On Wed, Sep 10, 2008 at 09:03:05AM +0100, Mike Ralphson wrote:\n> 2008/9/7 Arjen Laarhoven <arjen@yaph.org>\n> > The standard libc regex library on OSX does not support alternation\n> > in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n> > functionality on OSX.\n> >\n> > Also, I'm sure the problem occurs on more non-Linux systems (or non\n> > GNU libc systems).  If people who have access to those systems (BSD's,\n> > HP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\n> > patch so it can fix for multiple systems at once.\n> \n> I can confirm that the issue shown up by your new testcase is also\n> present in AIX 5.3.\n\nOk, I'll add AIX to the fix and a Tested-by: line.\n\n[snip]\n\n> Adding -lcompat/regex to COMPAT_CFLAGS as per your Darwin hunk\n> provokes lots of warnings:\n\nI think your problem is a lowercase ell instead of an uppercase i ;-)\n\nArjen\n\n-- \nArjen Laarhoven\n\nThe presence of those seeking the truth is infinitely to be preferred to \nthose who think they've found it.\n                                -- Terry Pratchett, \"Monstrous Regiment\"\n"},{"id":"90344","messageId":"e2b179460809100453r3df4ec8dh3d9bfbbd468c5676@mail.gmail.com","threadId":"15410","inReplyTo":"20080910100301.GA27748@regex.yaph.org","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-09-10T11:53:07Z","receivedAt":"2008-09-10T11:53:07Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/9/10 Arjen Laarhoven <arjen@yaph.org>:\n> On Wed, Sep 10, 2008 at 09:03:05AM +0100, Mike Ralphson wrote:\n>> 2008/9/7 Arjen Laarhoven <arjen@yaph.org>\n>> > The standard libc regex library on OSX does not support alternation\n>> > in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n>> > functionality on OSX.\n>> >\n>> > Also, I'm sure the problem occurs on more non-Linux systems (or non\n>> > GNU libc systems).  If people who have access to those systems (BSD's,\n>> > HP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\n>> > patch so it can fix for multiple systems at once.\n>>\n>> I can confirm that the issue shown up by your new testcase is also\n>> present in AIX 5.3.\n\n>> Adding -lcompat/regex to COMPAT_CFLAGS as per your Darwin hunk\n>> provokes lots of warnings:\n>\n> I think your problem is a lowercase ell instead of an uppercase i ;-)\n\nDoh. I think my problem is this font! And having not used a language\nwith a separate linker since last century.\n\nI guess I picked a really bad patch to try and pick up and test direct\nfrom gmail. No reflection on your patch, just my workflow.\n\nHaving carefully checked the content of the testcase too, I can now\nsay this does fix the issue without extra warnings or testcase\nfailures on AIX 5.3, so for what it's worth:\n\nTested-by: Mike Ralphson <mike@abacus.co.uk>\n\nThanks both, and sorry for the noise.\n\nMike\n"},{"id":"90422","messageId":"e2b179460809110059i2eca8b07x6d263f06cc8e5d32@mail.gmail.com","threadId":"15410","inReplyTo":"e2b179460809100453r3df4ec8dh3d9bfbbd468c5676@mail.gmail.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-09-11T07:59:29Z","receivedAt":"2008-09-11T07:59:29Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/9/10 Mike Ralphson <mike.ralphson@gmail.com>:\n> 2008/9/10 Arjen Laarhoven <arjen@yaph.org>:\n>> On Wed, Sep 10, 2008 at 09:03:05AM +0100, Mike Ralphson wrote:\n>>> 2008/9/7 Arjen Laarhoven <arjen@yaph.org>\n>>> > The standard libc regex library on OSX does not support alternation\n>>> > in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n>>> > functionality on OSX.\n>>> >\n>>> > Also, I'm sure the problem occurs on more non-Linux systems (or non\n>>> > GNU libc systems).  If people who have access to those systems (BSD's,\n>>> > HP-UX, AIX, etc) can test it, I'd be happy to add those systems to the\n>>> > patch so it can fix for multiple systems at once.\n>>>\n>>> I can confirm that the issue shown up by your new testcase is also\n>>> present in AIX 5.3.\n>\n>>> Adding -lcompat/regex to COMPAT_CFLAGS as per your Darwin hunk\n>>> provokes lots of warnings:\n>>\n>> I think your problem is a lowercase ell instead of an uppercase i ;-)\n>\n> Doh. I think my problem is this font! And having not used a language\n> with a separate linker since last century.\n>\n> I guess I picked a really bad patch to try and pick up and test direct\n> from gmail. No reflection on your patch, just my workflow.\n>\n> Having carefully checked the content of the testcase too, I can now\n> say this does fix the issue without extra warnings or testcase\n> failures on AIX 5.3, so for what it's worth:\n>\n> Tested-by: Mike Ralphson <mike@abacus.co.uk>\n\nJunio, sorry, I should have made this clear, but as above in the\nthread, Johannes Sixt's 'patchlet' is required to be squashed into\n3632cfc24, and I think Arjen was going to re-roll the patch.\n\nI can submit the required follow-up, but it really should have J6's S-o-b.\n\nMike\n"},{"id":"90423","messageId":"48C8D374.9050007@viscovery.net","threadId":"15410","inReplyTo":"e2b179460809110059i2eca8b07x6d263f06cc8e5d32@mail.gmail.com","subject":"[PATCH] Use compatibility regex library also on AIX","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-11T08:14:44Z","receivedAt":"2008-09-11T08:14:44Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"This augments 3632cfc24 (Use compatibility regex library on Darwin,\n2008-09-07), which already carries a \"Tested-by\" statement for AIX,\nbut that test was actually done with this patch included.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\nTested-by: Mike Ralphson <mike@abacus.co.uk>\n---\nMike Ralphson schrieb:\n> 2008/9/10 Mike Ralphson <mike.ralphson@gmail.com>:\n> Junio, sorry, I should have made this clear, but as above in the\n> thread, Johannes Sixt's 'patchlet' is required to be squashed into\n> 3632cfc24, and I think Arjen was going to re-roll the patch.\n> \n> I can submit the required follow-up, but it really should have J6's S-o-b.\n\nHere it is. Disclaimer: This patch submission was hand-crafted. ;)\n\n-- Hannes\n\ndiff --git a/Makefile b/Makefile\nindex 98d67f1..0637419 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -702,6 +702,8 @@ ifeq ($(uname_S),AIX)\n \tINTERNAL_QSORT = UnfortunatelyYes\n \tNEEDS_LIBICONV=YesPlease\n \tBASIC_CFLAGS += -D_LARGE_FILES\n+\tCOMPAT_CFLAGS += -Icompat/regex\n+\tCOMPAT_OBJS += compat/regex/regex.o\n endif\n ifeq ($(uname_S),GNU)\n \t# GNU/Hurd\n"},{"id":"90425","messageId":"20080911082554.GB27748@regex.yaph.org","threadId":"15410","inReplyTo":"48C8D374.9050007@viscovery.net","subject":"Re: [PATCH] Use compatibility regex library also on AIX","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2008-09-11T08:25:54Z","receivedAt":"2008-09-11T08:25:54Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"On Thu, Sep 11, 2008 at 10:14:44AM +0200, Johannes Sixt wrote:\n> This augments 3632cfc24 (Use compatibility regex library on Darwin,\n> 2008-09-07), which already carries a \"Tested-by\" statement for AIX,\n> but that test was actually done with this patch included.\n\nI hadn't realized it had already gone in to 'pu'.  I've put the AIX part\ninto my local patch, and also had it tested on HP-UX.  Today I'll\nprobably can test it on Solaris too, and add that as well.\n\nArjen\n\n-- \nArjen Laarhoven\n\nThe presence of those seeking the truth is infinitely to be preferred to \nthose who think they've found it.\n                                -- Terry Pratchett, \"Monstrous Regiment\"\n"},{"id":"90426","messageId":"7v7i9jt7dy.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"48C8D374.9050007@viscovery.net","subject":"Re: [PATCH] Use compatibility regex library also on AIX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-11T08:27:05Z","receivedAt":"2008-09-11T08:27:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> This augments 3632cfc24 (Use compatibility regex library on Darwin,\n> 2008-09-07), which already carries a \"Tested-by\" statement for AIX,\n> but that test was actually done with this patch included.\n>\n> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n> Tested-by: Mike Ralphson <mike@abacus.co.uk>\n> ---\n> Mike Ralphson schrieb:\n>> 2008/9/10 Mike Ralphson <mike.ralphson@gmail.com>:\n>> Junio, sorry, I should have made this clear, but as above in the\n>> thread, Johannes Sixt's 'patchlet' is required to be squashed into\n>> 3632cfc24, and I think Arjen was going to re-roll the patch.\n>> \n>> I can submit the required follow-up, but it really should have J6's S-o-b.\n>\n> Here it is. Disclaimer: This patch submission was hand-crafted. ;)\n\nSorry, my fault --- I should have noticed the missing \"ifeq AIX\"\nanywhere in the hunk headers.\n\nThanks.\n"},{"id":"90427","messageId":"e2b179460809110131h781f0c91i9d478e20b55dec24@mail.gmail.com","threadId":"15410","inReplyTo":"20080911082554.GB27748@regex.yaph.org","subject":"Re: [PATCH] Use compatibility regex library also on AIX","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-09-11T08:31:25Z","receivedAt":"2008-09-11T08:31:25Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/9/11 Arjen Laarhoven <arjen@yaph.org>:\n> On Thu, Sep 11, 2008 at 10:14:44AM +0200, Johannes Sixt wrote:\n>> This augments 3632cfc24 (Use compatibility regex library on Darwin,\n>> 2008-09-07), which already carries a \"Tested-by\" statement for AIX,\n>> but that test was actually done with this patch included.\n>\n> I hadn't realized it had already gone in to 'pu'.  I've put the AIX part\n> into my local patch, and also had it tested on HP-UX.  Today I'll\n> probably can test it on Solaris too, and add that as well.\n\nI think the reason it's in pu is that it's in maint, master and next too...\n\nAll my test runs went bang this morning. 8-)\n\n2008/9/11 Junio C Hamano <gitster@pobox.com>:\n> Sorry, my fault --- I should have noticed the missing \"ifeq AIX\"\n> anywhere in the hunk headers.\n\nNo, I shouldn't have added the Tested-by without making it clear I was\ntesting the tip of the thread, not the original patch. My bad.\n\nMike\n"},{"id":"90433","messageId":"20080911121216.GB17303@coredump.intra.peff.net","threadId":"15410","inReplyTo":"e2b179460809110131h781f0c91i9d478e20b55dec24@mail.gmail.com","subject":"Re: [PATCH] Use compatibility regex library also on AIX","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-11T12:12:16Z","receivedAt":"2008-09-11T12:12:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 11, 2008 at 09:31:25AM +0100, Mike Ralphson wrote:\n\n> I think the reason it's in pu is that it's in maint, master and next too...\n> \n> All my test runs went bang this morning. 8-)\n\nMine too. :)\n\nThis is needed for FreeBSD, as well. No idea about OpenBSD or others.\nShould probably be squashed with the AIX patch if it's not too late.\n\n-- >8 --\nUse compatibility regex library also on FreeBSD\n\nCommit 3632cfc24 makes the same change for Darwin; however, the problem\nalso exists on FreeBSD.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n\ndiff --git a/Makefile b/Makefile\nindex 247cd2d..9b1bd7b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -688,6 +688,8 @@ ifeq ($(uname_S),FreeBSD)\n \tBASIC_LDFLAGS += -L/usr/local/lib\n \tDIR_HAS_BSD_GROUP_SEMANTICS = YesPlease\n \tTHREADED_DELTA_SEARCH = YesPlease\n+\tCOMPAT_CFLAGS += -Icompat/regex\n+\tCOMPAT_OBJS += compat/regex/regex.o\n endif\n ifeq ($(uname_S),OpenBSD)\n \tNO_STRCASESTR = YesPlease\n"},{"id":"90852","messageId":"W_emvcr7ijntBMNCDV17_XHXotGkm1Bn-9Bw-ZixcXmFyBWlDj5vYg@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"20080907184537.GA4148@regex.yaph.org","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-16T17:49:20Z","receivedAt":"2008-09-16T17:49:20Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Arjen Laarhoven wrote:\n> The standard libc regex library on OSX does not support alternation\n> in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n> functionality on OSX.\n> \n> To fix this, we use the GNU regex library which is already present in\n> the compat/ diretory for the MinGW port.  However, simply adding compat/\n> to the COMPAT_CFLAGS variable causes a conflict between the system\n> fnmatch.h and the one present in compat/.  To remedy this, move the\n> regex and fnmatch functionality to their own subdirectories in compat/\n> so they can be included seperately.\n\n\nI wonder if this is the right fix? Right now the GNU regex library is\nnecessary for Darwin, FreeBSD and AIX. I can add IRIX6.5 and Solaris 7\nto that list. Have newer Solaris's been tested yet? (Jeff?) I wonder if\nthe new test which triggers this flaw has been tested on the other\nnon-GNU platforms in the Makefile which have not been updated. Boyd\nLynn Gerber and his 12 platforms comes to mind.\n\nIt seems POSIX only mentions alternation under Extended Regular Expressions.\nLikewise for the vertical-line character '|'.\n\nhttp://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04_07\n\nA look at compat/regex/regex.c: line 4723 shows that the default mode is\nRE_SYNTAX_POSIX_BASIC.\n\n>From the description in regex.h this mode includes \"...bits common to both\nbasic and extended POSIX regex syntax\". It seems this mode allows backslashed\nversions of the extended regular expression operators ?, +, and |.\n\nOther platforms which adhere more strictly to the POSIX spec do not interpret\nthe backslashed Ext-RE operators in Basic Regular Expression mode. Similar\nto GNU RE_SYNTAX_POSIX_MINIMAL_BASIC.\n\nIf I'm interpreting things correctly, then all non-GNU platforms may need the\ncompat regex library.\n\nOn a related note: Is there any reason why extended regular expressions\nwere not used by default? Wouldn't they have looked prettier (fewer backslashes)?\n\nIt's too late to change diff.*.funcname now, but an alternative fix which would\nprobably not require every other platform to use GNU regex, is to introduce a\nnew funcname option which would allow extended regular expression syntax and to\nconvert the internal regular expressions to that format.\n\n-brandon\n"},{"id":"90854","messageId":"7v3ak06jzj.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"W_emvcr7ijntBMNCDV17_XHXotGkm1Bn-9Bw-ZixcXmFyBWlDj5vYg@cipher.nrlssc.navy.mil","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-16T18:09:20Z","receivedAt":"2008-09-16T18:09:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> writes:\n\n> It's too late to change diff.*.funcname now, but an alternative fix\n> which would probably not require every other platform to use GNU regex,\n> is to introduce a new funcname option which would allow extended regular\n> expression syntax and to convert the internal regular expressions to\n> that format.\n\nThat's a very sensible approach, I would agree.\n"},{"id":"90856","messageId":"20080916190836.GA9870@sigill.intra.peff.net","threadId":"15410","inReplyTo":"W_emvcr7ijntBMNCDV17_XHXotGkm1Bn-9Bw-ZixcXmFyBWlDj5vYg@cipher.nrlssc.navy.mil","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-16T19:08:36Z","receivedAt":"2008-09-16T19:08:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 16, 2008 at 12:49:20PM -0500, Brandon Casey wrote:\n\n> I wonder if this is the right fix? Right now the GNU regex library is\n> necessary for Darwin, FreeBSD and AIX. I can add IRIX6.5 and Solaris 7\n> to that list. Have newer Solaris's been tested yet? (Jeff?) I wonder if\n\nI haven't tested; getting tests running under Solaris is on my long-term\ntodo. I'll try to look later today or tomorrow to see how this\nparticular one behaves.\n\n-Peff\n"},{"id":"90875","messageId":"alpine.LNX.1.10.0809161722580.18110@suse104.zenez.com","threadId":"15410","inReplyTo":"W_emvcr7ijntBMNCDV17_XHXotGkm1Bn-9Bw-ZixcXmFyBWlDj5vYg@cipher.nrlssc.navy.mil","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-16T23:25:46Z","receivedAt":"2008-09-16T23:25:46Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"Hello,\n\nOn Tue, 16 Sep 2008, Brandon Casey wrote:\n> Arjen Laarhoven wrote:\n>> The standard libc regex library on OSX does not support alternation\n>> in POSIX Basic Regular Expression mode.  This breaks the diff.funcname\n>> functionality on OSX.\n>>\n>> To fix this, we use the GNU regex library which is already present in\n>> the compat/ diretory for the MinGW port.  However, simply adding compat/\n>> to the COMPAT_CFLAGS variable causes a conflict between the system\n>> fnmatch.h and the one present in compat/.  To remedy this, move the\n>> regex and fnmatch functionality to their own subdirectories in compat/\n>> so they can be included seperately.\n>\n> I wonder if this is the right fix? Right now the GNU regex library is\n> necessary for Darwin, FreeBSD and AIX. I can add IRIX6.5 and Solaris 7\n> to that list. Have newer Solaris's been tested yet? (Jeff?) I wonder if\n> the new test which triggers this flaw has been tested on the other\n> non-GNU platforms in the Makefile which have not been updated. Boyd\n> Lynn Gerber and his 12 platforms comes to mind.\n>\n> It seems POSIX only mentions alternation under Extended Regular Expressions.\n> Likewise for the vertical-line character '|'.\n\nSomeone forwarded me this email and asked if I had tested it.  I have not. \nWhere is the easiest place to get it to test with the various platforms? \nI will check it out on 3-5 of them.  I now have 1.6.0.2 on 5 platforms \nrunning and working.  I have not had the time to get it on the other's \nyet.\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90877","messageId":"20080916233220.GA14173@coredump.intra.peff.net","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161722580.18110@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-16T23:32:20Z","receivedAt":"2008-09-16T23:32:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 16, 2008 at 05:25:46PM -0600, Boyd Lynn Gerber wrote:\n\n>> I wonder if this is the right fix? Right now the GNU regex library is\n>> necessary for Darwin, FreeBSD and AIX. I can add IRIX6.5 and Solaris 7\n>> to that list. Have newer Solaris's been tested yet? (Jeff?) I wonder if\n>> the new test which triggers this flaw has been tested on the other\n>> non-GNU platforms in the Makefile which have not been updated. Boyd\n>> Lynn Gerber and his 12 platforms comes to mind.\n>\n> Someone forwarded me this email and asked if I had tested it.  I have not. \n> Where is the easiest place to get it to test with the various platforms?  \n> I will check it out on 3-5 of them.  I now have 1.6.0.2 on 5 platforms  \n> running and working.  I have not had the time to get it on the other's  \n> yet.\n\nThe problematic test is in 1.6.0.2; if you can run t4018-diff-funcname\nsuccessfully, then I believe you are not affected.\n\n-Peff\n"},{"id":"90881","messageId":"alpine.LNX.1.10.0809161738010.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"20080916233220.GA14173@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-16T23:42:11Z","receivedAt":"2008-09-16T23:42:11Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Jeff King wrote:\n> On Tue, Sep 16, 2008 at 05:25:46PM -0600, Boyd Lynn Gerber wrote:\n>>> I wonder if this is the right fix? Right now the GNU regex library is\n>>> necessary for Darwin, FreeBSD and AIX. I can add IRIX6.5 and Solaris 7\n>>> to that list. Have newer Solaris's been tested yet? (Jeff?) I wonder if\n>>> the new test which triggers this flaw has been tested on the other\n>>> non-GNU platforms in the Makefile which have not been updated. Boyd\n>>> Lynn Gerber and his 12 platforms comes to mind.\n>>\n>> Someone forwarded me this email and asked if I had tested it.  I have not.\n>> Where is the easiest place to get it to test with the various platforms?\n>> I will check it out on 3-5 of them.  I now have 1.6.0.2 on 5 platforms\n>> running and working.  I have not had the time to get it on the other's\n>> yet.\n>\n> The problematic test is in 1.6.0.2; if you can run t4018-diff-funcname\n> successfully, then I believe you are not affected.\n\nWhen I do a gmake test these 4 platforms all fail only these 2 tests.\n\n* FAIL 10: reinit\n\n\n                 (\n                         unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG\n\n                         mkdir again &&\n                         cd again &&\n                         git init >out1 2>err1 &&\n                         git init >out2 2>err2\n                 ) &&\n                 grep \"Initialized empty\" again/out1 &&\n                 grep \"Reinitialized existing\" again/out2 &&\n                 >again/empty &&\n                 test_cmp again/empty again/err1 &&\n                 test_cmp again/empty again/err2\n\n* FAIL 11: init with --template\n\n                 mkdir template-source &&\n                 echo content >template-source/file &&\n                 (\n                         mkdir template-custom &&\n                         cd template-custom &&\n                         git init --template=../template-source\n                 ) &&\n                 test_cmp template-source/file template-custom/.git/file\n\n*   ok 12: init with --template (blank)\n* failed 2 among 12 test(s)\ngmake[1]: *** [t0001-init.sh] Error 1\ngmake[1]: Leaving directory `/home/zenez/build/osr6/git-1.6.0.2/t'\ngmake: *** [test] Error 2\n\nI have not had time to look into the failures.  How many tests should I \nsee and pass.  The first 40 all pass.  Then 2 of 12 fail as above.\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90883","messageId":"20080916234624.GA14405@coredump.intra.peff.net","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161738010.17105@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-16T23:46:24Z","receivedAt":"2008-09-16T23:46:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 16, 2008 at 05:42:11PM -0600, Boyd Lynn Gerber wrote:\n\n> When I do a gmake test these 4 platforms all fail only these 2 tests.\n>\n> * FAIL 10: reinit\n> [...]\n> * FAIL 11: init with --template\n> [...]\n> gmake[1]: *** [t0001-init.sh] Error 1\n>\n> I have not had time to look into the failures.  How many tests should I  \n> see and pass.  The first 40 all pass.  Then 2 of 12 fail as above.\n\nThese failures are unrelated to the described problem, and prevent the\nsystem from continuing on to run other tests.\n\nSo if you get a chance, please:\n\n  1. Run t0001 in verbose mode and report the results so we can get a\n     better idea of what's failing:\n\n       gmake test GIT_TEST_OPTS=--verbose\n\n  2. Run t4018 individually and report on the results:\n\n       cd t && gmake t4018-diff-funcname.sh\n\n-Peff\n"},{"id":"90886","messageId":"alpine.LNX.1.10.0809161808011.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"20080916234624.GA14405@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-17T00:10:30Z","receivedAt":"2008-09-17T00:10:30Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Jeff King wrote:\n> On Tue, Sep 16, 2008 at 05:42:11PM -0600, Boyd Lynn Gerber wrote:\n>> When I do a gmake test these 4 platforms all fail only these 2 tests.\n>> * FAIL 10: reinit\n>> [...]\n>> * FAIL 11: init with --template\n>> [...]\n>> gmake[1]: *** [t0001-init.sh] Error 1\n>>\n>  1. Run t0001 in verbose mode and report the results so we can get a\n>     better idea of what's failing:\n>\n>       gmake test GIT_TEST_OPTS=--verbose\n\n\n* expecting success:\n\n         (\n                 unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG\n\n                 mkdir again &&\n                 cd again &&\n                 git init >out1 2>err1 &&\n                 git init >out2 2>err2\n         ) &&\n         grep \"Initialized empty\" again/out1 &&\n         grep \"Reinitialized existing\" again/out2 &&\n         >again/empty &&\n         test_cmp again/empty again/err1 &&\n         test_cmp again/empty again/err2\n\nInitialized empty Git repository in \n/home/zenez/build/osr6/git-1.6.0.2/t/trash directory/again/.git/\nReinitialized existing Git repository in \n/home/zenez/build/osr6/git-1.6.0.2/t/trash directory/again/.git/\ndiff: ERROR: Illegal option -- u\nUsage: diff [ -bcefhrC<n> ] file1 file2\n* FAIL 10: reinit\n                 (\n                         unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG\n\n                         mkdir again &&\n                         cd again &&\n                         git init >out1 2>err1 &&\n                         git init >out2 2>err2\n                 ) &&\n                 grep \"Initialized empty\" again/out1 &&\n                 grep \"Reinitialized existing\" again/out2 &&\n                 >again/empty &&\n                 test_cmp again/empty again/err1 &&\n                 test_cmp again/empty again/err2\n\n* expecting success:\n         mkdir template-source &&\n         echo content >template-source/file &&\n         (\n                 mkdir template-custom &&\n                 cd template-custom &&\n                 git init --template=../template-source\n         ) &&\n         test_cmp template-source/file template-custom/.git/file\n\nInitialized empty Git repository in \n/home/zenez/build/osr6/git-1.6.0.2/t/trash directory/template-custom/.git/\ndiff: ERROR: Illegal option -- u\nUsage: diff [ -bcefhrC<n> ] file1 file2\n* FAIL 11: init with --template\n\n                 mkdir template-source &&\n                 echo content >template-source/file &&\n                 (\n                         mkdir template-custom &&\n                         cd template-custom &&\n                         git init --template=../template-source\n                 ) &&\n                 test_cmp template-source/file template-custom/.git/file\n\n* expecting success:\n         (\n                 mkdir template-plain &&\n                 cd template-plain &&\n                 git init\n         ) &&\n         test -f template-plain/.git/info/exclude &&\n         (\n                 mkdir template-blank &&\n                 cd template-blank &&\n                 git init --template=\n         ) &&\n         ! test -f template-blank/.git/info/exclude\n\nInitialized empty Git repository in \n/home/zenez/build/osr6/git-1.6.0.2/t/trash directory/template-plain/.git/\nInitialized empty Git repository in \n/home/zenez/build/osr6/git-1.6.0.2/t/trash directory/template-blank/.git/\n\n>  2. Run t4018 individually and report on the results:\n>\n>       cd t && gmake t4018-diff-funcname.sh\n\n\n3 systems all give me this.\n\n$ cd t && gmake t4018-diff-funcname.sh\n*** t4018-diff-funcname.sh ***\nt4018-diff-funcname.sh: syntax error at line 52: `(' unexpected\ngmake: *** [t4018-diff-funcname.sh] Error 2\n\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90888","messageId":"SYLwfNw_i8AJD2SReRObweoVtWG2KY6sT1-akI631fOeWpAzh0OGeQ@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161808011.17105@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-17T00:13:50Z","receivedAt":"2008-09-17T00:13:50Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Boyd Lynn Gerber wrote:\n\n> * expecting success:\n> \n>         (\n>                 unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG\n> \n>                 mkdir again &&\n>                 cd again &&\n>                 git init >out1 2>err1 &&\n>                 git init >out2 2>err2\n>         ) &&\n>         grep \"Initialized empty\" again/out1 &&\n>         grep \"Reinitialized existing\" again/out2 &&\n>         >again/empty &&\n>         test_cmp again/empty again/err1 &&\n>         test_cmp again/empty again/err2\n> \n> Initialized empty Git repository in\n> /home/zenez/build/osr6/git-1.6.0.2/t/trash directory/again/.git/\n> Reinitialized existing Git repository in\n> /home/zenez/build/osr6/git-1.6.0.2/t/trash directory/again/.git/\n> diff: ERROR: Illegal option -- u\n> Usage: diff [ -bcefhrC<n> ] file1 file2\n\nThe tests are failing at the test_cmp line. By default, test_cmp is\nset to 'diff -u'. Perhaps you usually set test_cmp to something else\nlike 'cmp -s' or modify your path so that a more modern diff is used?\n\n-brandon\n"},{"id":"90887","messageId":"alpine.LNX.1.10.0809161811100.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"20080916234624.GA14405@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-17T00:13:56Z","receivedAt":"2008-09-17T00:13:56Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Jeff King wrote:\n> On Tue, Sep 16, 2008 at 05:42:11PM -0600, Boyd Lynn Gerber wrote:\n>> When I do a gmake test these 4 platforms all fail only these 2 tests.\n>>\n>> * FAIL 10: reinit\n>> [...]\n>> * FAIL 11: init with --template\n>> [...]\n>> gmake[1]: *** [t0001-init.sh] Error 1\n>>\n>> I have not had time to look into the failures.  How many tests should I\n>> see and pass.  The first 40 all pass.  Then 2 of 12 fail as above.\n>\n> These failures are unrelated to the described problem, and prevent the\n> system from continuing on to run other tests.\n>\n> So if you get a chance, please:\n>\n>  1. Run t0001 in verbose mode and report the results so we can get a\n>     better idea of what's failing:\n>\n>       gmake test GIT_TEST_OPTS=--verbose\n\nIf I use gdiff or make gnu diff and put it in /usr/local/bin/ and change \nthe path to have /usr/local/bin first it does not fail/.\n\nI have a /usr/gnu/bin/... where I have gdiff linked to diff.\n\n# /usr/gnu/bin/diff --version\ndiff (GNU diffutils) 2.8.1\nCopyright (C) 2002 Free Software Foundation, Inc.\n\nThis program comes with NO WARRANTY, to the extent permitted by law.\nYou may redistribute copies of this program\nunder the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n\nWritten by Paul Eggert, Mike Haertel, David Hayes,\nRichard Stallman, and Len Tower.\n\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90889","messageId":"a4X38z5PMKaSj4KeLKBBqWb9elMD_Pp1n1eMqdmujRqMrr9xtvQAfA@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161811100.17105@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-17T00:20:25Z","receivedAt":"2008-09-17T00:20:25Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Boyd Lynn Gerber wrote:\n\n> If I use gdiff or make gnu diff and put it in /usr/local/bin/ and change\n> the path to have /usr/local/bin first it does not fail/.\n> \n> I have a /usr/gnu/bin/... where I have gdiff linked to diff.\n\nYou must have done something like this in the past when you were testing\nprevious versions since the test_cmp variable has not changed.\n\nSo, for future reference either have a diff that understands '-u' in your\npath, or set the test_cmp environment variable.\n\n-brandon\n"},{"id":"90890","messageId":"alpine.LNX.1.10.0809161824470.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"a4X38z5PMKaSj4KeLKBBqWb9elMD_Pp1n1eMqdmujRqMrr9xtvQAfA@cipher.nrlssc.navy.mil","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-17T00:38:11Z","receivedAt":"2008-09-17T00:38:11Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Brandon Casey wrote:\n> Boyd Lynn Gerber wrote:\n>> If I use gdiff or make gnu diff and put it in /usr/local/bin/ and change\n>> the path to have /usr/local/bin first it does not fail/.\n>>\n>> I have a /usr/gnu/bin/... where I have gdiff linked to diff.\n>\n> You must have done something like this in the past when you were testing \n> previous versions since the test_cmp variable has not changed.\n>\n> So, for future reference either have a diff that understands '-u' in \n> your path, or set the test_cmp environment variable.\n\nI had customized things so that any GNU util used gutil_name.  This is \nthe easiest way for me to distinguish between Native utils and GNU utils.\n\nIs there an easy way to have git use gcommand_name instead of \ncommand_name?  I changed the path to run the git test, but not all my \nclients will allow be to have the gnu named command instead of the native \ncommand.  There programs require the non GNU functionality.  That is why I \ncreate a /usr/gnu/  with all the GNU stuff available for my use, but \nhaving to change paths back and forth just to run git is a pain when \nbuild/trouble shooting customer  aplications.\n\nThanks,\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90891","messageId":"VPAf9PbSSJcz5E923jIMO7Zjvp4Iw0PwpJfuSJUAeCI5etNDRv9pfQ@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161824470.17105@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-17T00:58:02Z","receivedAt":"2008-09-17T00:58:02Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Boyd Lynn Gerber wrote:\n> On Tue, 16 Sep 2008, Brandon Casey wrote:\n>> Boyd Lynn Gerber wrote:\n>>> If I use gdiff or make gnu diff and put it in /usr/local/bin/ and change\n>>> the path to have /usr/local/bin first it does not fail/.\n>>>\n>>> I have a /usr/gnu/bin/... where I have gdiff linked to diff.\n>>\n>> You must have done something like this in the past when you were\n>> testing previous versions since the test_cmp variable has not changed.\n>>\n>> So, for future reference either have a diff that understands '-u' in\n>> your path, or set the test_cmp environment variable.\n> \n> I had customized things so that any GNU util used gutil_name.  This is\n> the easiest way for me to distinguish between Native utils and GNU utils.\n> \n> Is there an easy way to have git use gcommand_name instead of\n> command_name?\n\nNot that I know of.\n\n>  I changed the path to run the git test, but not all my\n> clients will allow be to have the gnu named command instead of the\n> native command.  There programs require the non GNU functionality.  That\n> is why I create a /usr/gnu/  with all the GNU stuff available for my\n> use, but having to change paths back and forth just to run git is a pain\n> when build/trouble shooting customer  aplications.\n\nI usually create a little compile script which sets the environment\nvariables the way I want, and calls make or gmake appropriately.\n\nFor the test suite you can set (if necessary):\n  test_cmp\n  TAR\n\n'git grep' sometimes calls native grep. You can disallow this by setting\nthe Makefile variable NO_EXTERNAL_GREP.\n\nAnd of course SHELL_PATH can be used to set the path to the shell that\nall shell code should be executed with.\n\n-brandon\n"},{"id":"90892","messageId":"alpine.LNX.1.10.0809161900340.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"20080916234624.GA14405@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-17T01:02:41Z","receivedAt":"2008-09-17T01:02:41Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Jeff King wrote:\n> On Tue, Sep 16, 2008 at 05:42:11PM -0600, Boyd Lynn Gerber wrote:\n>> When I do a gmake test these 4 platforms all fail only these 2 tests.\n>>\n>> * FAIL 10: reinit\n>> [...]\n>> * FAIL 11: init with --template\n>> [...]\n>> gmake[1]: *** [t0001-init.sh] Error 1\n>>\n>> I have not had time to look into the failures.  How many tests should I\n>> see and pass.  The first 40 all pass.  Then 2 of 12 fail as above.\n>\n> These failures are unrelated to the described problem, and prevent the\n> system from continuing on to run other tests.\n>\n> So if you get a chance, please:\n>\n>       gmake test GIT_TEST_OPTS=--verbose\n\nSo with path set so my /usr/gnu/bin/ is before any others this is what I \nget as the next failure.  After a long run...\n\n* FAIL 5: alternation in pattern\n\n                 git config diff.java.funcname \"^[ \n]*\\(\\(public\\|static\\).*\\)$\"\n                 git diff --no-index Beer.java Beer-correct.java |\n                 grep \"^@@.*@@ public static void main(\"\n\n\n* failed 1 among 5 test(s)\ngmake[1]: *** [t4018-diff-funcname.sh] Error 1\ngmake[1]: Leaving directory `/home/zenez/build/osr6/git-1.6.0.2/t'\ngmake: *** [test] Error 2\n\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90894","messageId":"_MhavOIoKmx4_xVm-blejLMi-eFa1T8Huv94Uz9PxwJ3DyOMzuyUeg@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"alpine.LNX.1.10.0809161900340.17105@suse104.zenez.com","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-17T01:25:09Z","receivedAt":"2008-09-17T01:25:09Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Boyd Lynn Gerber wrote:\n\n> So with path set so my /usr/gnu/bin/ is before any others this is what I\n> get as the next failure.  After a long run...\n> \n> * FAIL 5: alternation in pattern\n> \n>                 git config diff.java.funcname \"^[\n> ]*\\(\\(public\\|static\\).*\\)$\"\n>                 git diff --no-index Beer.java Beer-correct.java |\n>                 grep \"^@@.*@@ public static void main(\"\n> \n> \n> * failed 1 among 5 test(s)\n> gmake[1]: *** [t4018-diff-funcname.sh] Error 1\n> gmake[1]: Leaving directory `/home/zenez/build/osr6/git-1.6.0.2/t'\n> gmake: *** [test] Error 2\n\nThat's the one, thanks.\n\nAnd just so you know, this isn't a regression. It's just a new test that\nwas designed to reveal a shortcoming that no one knew existed before Arjen\ndiscovered it.\n\n-brandon\n"},{"id":"90948","messageId":"alpine.LNX.1.10.0809170845240.17105@suse104.zenez.com","threadId":"15410","inReplyTo":"_MhavOIoKmx4_xVm-blejLMi-eFa1T8Huv94Uz9PxwJ3DyOMzuyUeg@cipher.nrlssc.navy.mil","subject":"Re: [RFC/PATCH] Use compatibility regex library for OSX/Darwin","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-09-17T14:48:18Z","receivedAt":"2008-09-17T14:48:18Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Tue, 16 Sep 2008, Brandon Casey wrote:\n> Boyd Lynn Gerber wrote:\n>> So with path set so my /usr/gnu/bin/ is before any others this is what I\n>> get as the next failure.  After a long run...\n>>\n>> * FAIL 5: alternation in pattern\n>>\n>>                 git config diff.java.funcname \"^[\n>> ]*\\(\\(public\\|static\\).*\\)$\"\n>>                 git diff --no-index Beer.java Beer-correct.java |\n>>                 grep \"^@@.*@@ public static void main(\"\n>>\n>>\n>> * failed 1 among 5 test(s)\n>> gmake[1]: *** [t4018-diff-funcname.sh] Error 1\n>> gmake[1]: Leaving directory `/home/zenez/build/osr6/git-1.6.0.2/t'\n>> gmake: *** [test] Error 2\n>\n> That's the one, thanks.\n>\n> And just so you know, this isn't a regression. It's just a new test that\n> was designed to reveal a shortcoming that no one knew existed before Arjen\n> discovered it.\n\nSix of the 12 all have the same problem.  I would say all 12 have it as my \nexperience has shown that if these have it then all have it.  The fixes I \ndid were so generic that once I got these first 6 working the others just \nworked.  So I would say they all need the patch or fix.  Sorry I did not \nfollow the whole thread.  I read it from the archive what I could.  It \nseems the archive is about 2 days behind.\n\nGood Luck,\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"},{"id":"90982","messageId":"bM_-9C7AsEGzvM1pnb0gAo_24GfK0SpJFM36WzkP4Ho@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"7v3ak06jzj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 1/4] diff.c: return pattern entry pointer rather than just the hunk header pattern","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T00:08:39Z","receivedAt":"2008-09-18T00:08:39Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"This is in preparation for associating a flag with each pattern which will\ncontrol how the pattern is interpreted. For example, as a basic or extended\nregular expression.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nSorry for the dup, I forgot to add the list.\n\n\nJunio C Hamano wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n> \n>> It's too late to change diff.*.funcname now, but an alternative fix\n>> which would probably not require every other platform to use GNU regex,\n>> is to introduce a new funcname option which would allow extended regular\n>> expression syntax and to convert the internal regular expressions to\n>> that format.\n> \n> That's a very sensible approach, I would agree.\n\n\n diff.c |   53 ++++++++++++++++++++++++++++++-----------------------\n 1 files changed, 30 insertions(+), 23 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 998dcaa..e040088 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -94,6 +94,8 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val\n  * 'diff.<what>.funcname' attribute can be specified in the configuration\n  * to define a customized regexp to find the beginning of a function to\n  * be used for hunk header lines of \"diff -p\" style output.\n+ * Note: If this structure is modified, it must retain the ability to be cast\n+ * to a struct funcname_pattern_entry, defined elsewhere.\n  */\n static struct funcname_pattern {\n \tchar *name;\n@@ -1382,17 +1384,11 @@ int diff_filespec_is_binary(struct diff_filespec *one)\n \treturn one->is_binary;\n }\n \n-static const char *funcname_pattern(const char *ident)\n-{\n-\tstruct funcname_pattern *pp;\n-\n-\tfor (pp = funcname_pattern_list; pp; pp = pp->next)\n-\t\tif (!strcmp(ident, pp->name))\n-\t\t\treturn pp->pattern;\n-\treturn NULL;\n-}\n-\n-static struct builtin_funcname_pattern {\n+/*\n+ * Note: The elements of this structure must be arranged so that they are\n+ *       compatible with the elements of the funcname_pattern structure.\n+ */\n+static struct funcname_pattern_entry {\n \tconst char *name;\n \tconst char *pattern;\n } builtin_funcname_pattern[] = {\n@@ -1415,9 +1411,20 @@ static struct builtin_funcname_pattern {\n \t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\" },\n };\n \n-static const char *diff_funcname_pattern(struct diff_filespec *one)\n+static const struct funcname_pattern_entry *funcname_pattern(const char *ident)\n+{\n+\tstruct funcname_pattern *pp;\n+\n+\tfor (pp = funcname_pattern_list; pp; pp = pp->next)\n+\t\tif (!strcmp(ident, pp->name))\n+\t\t\treturn (struct funcname_pattern_entry*) pp;\n+\treturn NULL;\n+}\n+\n+static const struct funcname_pattern_entry *diff_funcname_pattern(struct diff_filespec *one)\n {\n-\tconst char *ident, *pattern;\n+\tconst char *ident;\n+\tconst struct funcname_pattern_entry *pe;\n \tint i;\n \n \tdiff_filespec_check_attr(one);\n@@ -1432,9 +1439,9 @@ static const char *diff_funcname_pattern(struct diff_filespec *one)\n \t\treturn funcname_pattern(\"default\");\n \n \t/* Look up custom \"funcname.$ident\" regexp from config. */\n-\tpattern = funcname_pattern(ident);\n-\tif (pattern)\n-\t\treturn pattern;\n+\tpe = funcname_pattern(ident);\n+\tif (pe)\n+\t\treturn pe;\n \n \t/*\n \t * And define built-in fallback patterns here.  Note that\n@@ -1442,7 +1449,7 @@ static const char *diff_funcname_pattern(struct diff_filespec *one)\n \t */\n \tfor (i = 0; i < ARRAY_SIZE(builtin_funcname_pattern); i++)\n \t\tif (!strcmp(ident, builtin_funcname_pattern[i].name))\n-\t\t\treturn builtin_funcname_pattern[i].pattern;\n+\t\t\treturn &builtin_funcname_pattern[i];\n \n \treturn NULL;\n }\n@@ -1520,11 +1527,11 @@ static void builtin_diff(const char *name_a,\n \t\txdemitconf_t xecfg;\n \t\txdemitcb_t ecb;\n \t\tstruct emit_callback ecbdata;\n-\t\tconst char *funcname_pattern;\n+\t\tconst struct funcname_pattern_entry *pe;\n \n-\t\tfuncname_pattern = diff_funcname_pattern(one);\n-\t\tif (!funcname_pattern)\n-\t\t\tfuncname_pattern = diff_funcname_pattern(two);\n+\t\tpe = diff_funcname_pattern(one);\n+\t\tif (!pe)\n+\t\t\tpe = diff_funcname_pattern(two);\n \n \t\tmemset(&xecfg, 0, sizeof(xecfg));\n \t\tmemset(&ecbdata, 0, sizeof(ecbdata));\n@@ -1536,8 +1543,8 @@ static void builtin_diff(const char *name_a,\n \t\txpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;\n \t\txecfg.ctxlen = o->context;\n \t\txecfg.flags = XDL_EMIT_FUNCNAMES;\n-\t\tif (funcname_pattern)\n-\t\t\txdiff_set_find_func(&xecfg, funcname_pattern);\n+\t\tif (pe)\n+\t\t\txdiff_set_find_func(&xecfg, pe->pattern);\n \t\tif (!diffopts)\n \t\t\t;\n \t\telse if (!prefixcmp(diffopts, \"--unified=\"))\n-- \n1.6.0.1.244.gdc19\n"},{"id":"90983","messageId":"GZAEBf1BcP9-dznrIesxaE4Rb8bim6DpwDWCb9yWl99UVoQC9Dog0A@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"7v3ak06jzj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T00:10:02Z","receivedAt":"2008-09-18T00:10:02Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"This is in preparation for allowing extended regular expression patterns.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n diff.c            |   28 ++++++++++++++++------------\n xdiff-interface.c |    4 ++--\n xdiff-interface.h |    2 +-\n 3 files changed, 19 insertions(+), 15 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex e040088..4363d0d 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -100,10 +100,11 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val\n static struct funcname_pattern {\n \tchar *name;\n \tchar *pattern;\n+\tint cflags;\n \tstruct funcname_pattern *next;\n } *funcname_pattern_list;\n \n-static int parse_funcname_pattern(const char *var, const char *ep, const char *value)\n+static int parse_funcname_pattern(const char *var, const char *ep, const char *value, int cflags)\n {\n \tconst char *name;\n \tint namelen;\n@@ -123,6 +124,7 @@ static int parse_funcname_pattern(const char *var, const char *ep, const char *v\n \t}\n \tfree(pp->pattern);\n \tpp->pattern = xstrdup(value);\n+\tpp->cflags = cflags;\n \treturn 0;\n }\n \n@@ -191,7 +193,8 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)\n \t\t\tif (!strcmp(ep, \".funcname\")) {\n \t\t\t\tif (!value)\n \t\t\t\t\treturn config_error_nonbool(var);\n-\t\t\t\treturn parse_funcname_pattern(var, ep, value);\n+\t\t\t\treturn parse_funcname_pattern(var, ep, value,\n+\t\t\t\t\t0);\n \t\t\t}\n \t\t}\n \t}\n@@ -1391,24 +1394,25 @@ int diff_filespec_is_binary(struct diff_filespec *one)\n static struct funcname_pattern_entry {\n \tconst char *name;\n \tconst char *pattern;\n+\tconst int cflags;\n } builtin_funcname_pattern[] = {\n-\t{ \"bibtex\", \"\\\\(@[a-zA-Z]\\\\{1,\\\\}[ \\t]*{\\\\{0,1\\\\}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*\\\\).*$\" },\n-\t{ \"html\", \"^\\\\s*\\\\(<[Hh][1-6]\\\\s.*>.*\\\\)$\" },\n+\t{ \"bibtex\", \"\\\\(@[a-zA-Z]\\\\{1,\\\\}[ \\t]*{\\\\{0,1\\\\}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*\\\\).*$\", 0 },\n+\t{ \"html\", \"^\\\\s*\\\\(<[Hh][1-6]\\\\s.*>.*\\\\)$\", 0 },\n \t{ \"java\", \"!^[ \t]*\\\\(catch\\\\|do\\\\|for\\\\|if\\\\|instanceof\\\\|\"\n \t\t\t\"new\\\\|return\\\\|switch\\\\|throw\\\\|while\\\\)\\n\"\n \t\t\t\"^[ \t]*\\\\(\\\\([ \t]*\"\n \t\t\t\"[A-Za-z_][A-Za-z_0-9]*\\\\)\\\\{2,\\\\}\"\n-\t\t\t\"[ \t]*([^;]*\\\\)$\" },\n+\t\t\t\"[ \t]*([^;]*\\\\)$\", 0 },\n \t{ \"pascal\", \"^\\\\(\\\\(procedure\\\\|function\\\\|constructor\\\\|\"\n \t\t\t\"destructor\\\\|interface\\\\|implementation\\\\|\"\n \t\t\t\"initialization\\\\|finalization\\\\)[ \\t]*.*\\\\)$\"\n \t\t\t\"\\\\|\"\n-\t\t\t\"^\\\\(.*=[ \\t]*\\\\(class\\\\|record\\\\).*\\\\)$\"\n-\t\t\t},\n-\t{ \"php\", \"^[\\t ]*\\\\(\\\\(function\\\\|class\\\\).*\\\\)\" },\n-\t{ \"python\", \"^\\\\s*\\\\(\\\\(class\\\\|def\\\\)\\\\s.*\\\\)$\" },\n-\t{ \"ruby\", \"^\\\\s*\\\\(\\\\(class\\\\|module\\\\|def\\\\)\\\\s.*\\\\)$\" },\n-\t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\" },\n+\t\t\t\"^\\\\(.*=[ \\t]*\\\\(class\\\\|record\\\\).*\\\\)$\",\n+\t\t\t0 },\n+\t{ \"php\", \"^[\\t ]*\\\\(\\\\(function\\\\|class\\\\).*\\\\)\", 0 },\n+\t{ \"python\", \"^\\\\s*\\\\(\\\\(class\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n+\t{ \"ruby\", \"^\\\\s*\\\\(\\\\(class\\\\|module\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n+\t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\", 0 },\n };\n \n static const struct funcname_pattern_entry *funcname_pattern(const char *ident)\n@@ -1544,7 +1548,7 @@ static void builtin_diff(const char *name_a,\n \t\txecfg.ctxlen = o->context;\n \t\txecfg.flags = XDL_EMIT_FUNCNAMES;\n \t\tif (pe)\n-\t\t\txdiff_set_find_func(&xecfg, pe->pattern);\n+\t\t\txdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);\n \t\tif (!diffopts)\n \t\t\t;\n \t\telse if (!prefixcmp(diffopts, \"--unified=\"))\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 944ad98..7f1a7d3 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -218,7 +218,7 @@ static long ff_regexp(const char *line, long len,\n \treturn result;\n }\n \n-void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value)\n+void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value, int cflags)\n {\n \tint i;\n \tstruct ff_regs *regs;\n@@ -243,7 +243,7 @@ void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value)\n \t\t\texpression = buffer = xstrndup(value, ep - value);\n \t\telse\n \t\t\texpression = value;\n-\t\tif (regcomp(&reg->re, expression, 0))\n+\t\tif (regcomp(&reg->re, expression, cflags))\n \t\t\tdie(\"Invalid regexp to look for hunk header: %s\", expression);\n \t\tfree(buffer);\n \t\tvalue = ep + 1;\ndiff --git a/xdiff-interface.h b/xdiff-interface.h\nindex 558492b..23c49b9 100644\n--- a/xdiff-interface.h\n+++ b/xdiff-interface.h\n@@ -16,6 +16,6 @@ int parse_hunk_header(char *line, int len,\n int read_mmfile(mmfile_t *ptr, const char *filename);\n int buffer_is_binary(const char *ptr, unsigned long size);\n \n-extern void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line);\n+extern void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);\n \n #endif\n-- \n1.6.0.1.244.gdc19\n"},{"id":"90984","messageId":"wgfIh_UVzwhXaVTN46Io8UDAq72MVwOkk7CobrAvp0330VRzwT2fuA@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"7v3ak06jzj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 3/4] diff.*.xfuncname which uses \"extended\" regex's for hunk header selection","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T00:10:50Z","receivedAt":"2008-09-18T00:10:50Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Currently, the hunk headers produced by 'diff -p' are customizable by\nsetting the diff.*.funcname option in the config file. The 'funcname' option\ntakes a basic regular expression. This functionality was designed using the\nGNU regex library which, by default, allows using backslashed versions of\nsome extended regular expression operators, even in Basic Regular Expression\nmode. For example, the following characters, when backslashed, are\ninterpreted according to the extended regular expression rules: ?, +, and |.\nAs such, the builtin funcname patterns were created using some extended\nregular expression operators.\n\nOther platforms which adhere more strictly to the POSIX spec do not\ninterpret the backslashed extended RE operators in Basic Regular Expression\nmode. This causes the pattern matching for the builtin funcname patterns to\nfail on those platforms.\n\nIntroduce a new option 'xfuncname' which uses extended regular expressions,\nand advertise it _instead_ of funcname. Since most users are on GNU\nplatforms, the majority of funcname patterns are created and tested there.\nAdvertising only xfuncname should help to avoid the creation of non-portable\npatterns which work with GNU regex but not elsewhere.\n\nAdditionally, the extended regular expressions may be less ugly and\ncomplicated compared to the basic RE since many common special operators do\nnot need to be backslashed.\n\nFor example, the GNU Basic RE:\n\n    ^[ \t]*\\\\(\\\\(public\\\\|static\\\\).*\\\\)$\n\nbecomes the following Extended RE:\n\n    ^[ \t]*((public|static).*)$\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n Documentation/gitattributes.txt |    4 ++--\n diff.c                          |    5 +++++\n t/t4018-diff-funcname.sh        |    2 +-\n 3 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 6f3551d..fa04eca 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -288,13 +288,13 @@ for paths.\n *.tex\tdiff=tex\n ------------------------\n \n-Then, you would define \"diff.tex.funcname\" configuration to\n+Then, you would define \"diff.tex.xfuncname\" configuration to\n specify a regular expression that matches a line that you would\n want to appear as the hunk header, like this:\n \n ------------------------\n [diff \"tex\"]\n-\tfuncname = \"^\\\\(\\\\\\\\\\\\(sub\\\\)*section{.*\\\\)$\"\n+\txfuncname = \"^(\\\\\\\\(sub)*section{.*)$\"\n ------------------------\n \n Note.  A single level of backslashes are eaten by the\ndiff --git a/diff.c b/diff.c\nindex 4363d0d..ad5e551 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -195,6 +195,11 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)\n \t\t\t\t\treturn config_error_nonbool(var);\n \t\t\t\treturn parse_funcname_pattern(var, ep, value,\n \t\t\t\t\t0);\n+\t\t\t} else if (!strcmp(ep, \".xfuncname\")) {\n+\t\t\t\tif (!value)\n+\t\t\t\t\treturn config_error_nonbool(var);\n+\t\t\t\treturn parse_funcname_pattern(var, ep, value,\n+\t\t\t\t\tREG_EXTENDED);\n \t\t\t}\n \t\t}\n \t}\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 18bcd97..602d68f 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -58,7 +58,7 @@ test_expect_success 'last regexp must not be negated' '\n '\n \n test_expect_success 'alternation in pattern' '\n-\tgit config diff.java.funcname \"^[ \t]*\\\\(\\\\(public\\\\|static\\\\).*\\\\)$\"\n+\tgit config diff.java.xfuncname \"^[ \t]*((public|static).*)$\" &&\n \tgit diff --no-index Beer.java Beer-correct.java |\n \tgrep \"^@@.*@@ public static void main(\"\n '\n-- \n1.6.0.1.244.gdc19\n"},{"id":"90985","messageId":"-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"7v3ak06jzj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T00:21:47Z","receivedAt":"2008-09-18T00:21:47Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nThis is a blind conversion removing \\\\ before ( and { etc.\nand adding \\\\ before naked ( and { etc.\n\nI hope the authors who last touched these patterns will help with testing:\n\nbibtex: Johan Herland\n  html: Johan Herland\n  java: Junio Hamano, Jeff King\npascal: Avery Pennarun\n   php: Andreas Ericsson\npython: Kirill Smelkov\n  ruby: Giuseppe Bilotta\n   tex: Johan Herland\n\nthanks,\n-brandon\n\n\n diff.c |   34 +++++++++++++++++-----------------\n 1 files changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex ad5e551..25d2259 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1401,23 +1401,23 @@ static struct funcname_pattern_entry {\n \tconst char *pattern;\n \tconst int cflags;\n } builtin_funcname_pattern[] = {\n-\t{ \"bibtex\", \"\\\\(@[a-zA-Z]\\\\{1,\\\\}[ \\t]*{\\\\{0,1\\\\}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*\\\\).*$\", 0 },\n-\t{ \"html\", \"^\\\\s*\\\\(<[Hh][1-6]\\\\s.*>.*\\\\)$\", 0 },\n-\t{ \"java\", \"!^[ \t]*\\\\(catch\\\\|do\\\\|for\\\\|if\\\\|instanceof\\\\|\"\n-\t\t\t\"new\\\\|return\\\\|switch\\\\|throw\\\\|while\\\\)\\n\"\n-\t\t\t\"^[ \t]*\\\\(\\\\([ \t]*\"\n-\t\t\t\"[A-Za-z_][A-Za-z_0-9]*\\\\)\\\\{2,\\\\}\"\n-\t\t\t\"[ \t]*([^;]*\\\\)$\", 0 },\n-\t{ \"pascal\", \"^\\\\(\\\\(procedure\\\\|function\\\\|constructor\\\\|\"\n-\t\t\t\"destructor\\\\|interface\\\\|implementation\\\\|\"\n-\t\t\t\"initialization\\\\|finalization\\\\)[ \\t]*.*\\\\)$\"\n-\t\t\t\"\\\\|\"\n-\t\t\t\"^\\\\(.*=[ \\t]*\\\\(class\\\\|record\\\\).*\\\\)$\",\n-\t\t\t0 },\n-\t{ \"php\", \"^[\\t ]*\\\\(\\\\(function\\\\|class\\\\).*\\\\)\", 0 },\n-\t{ \"python\", \"^\\\\s*\\\\(\\\\(class\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n-\t{ \"ruby\", \"^\\\\s*\\\\(\\\\(class\\\\|module\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n-\t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\", 0 },\n+\t{ \"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#\\\\}\\\\{~%]*).*$\", 1 },\n+\t{ \"html\", \"^\\\\s*(<[Hh][1-6]\\\\s.*>.*)$\", 1 },\n+\t{ \"java\", \"!^[ \t]*(catch|do|for|if|instanceof|\"\n+\t\t\t\"new|return|switch|throw|while)\\n\"\n+\t\t\t\"^[ \t]*(([ \t]*\"\n+\t\t\t\"[A-Za-z_][A-Za-z_0-9]*){2,}\"\n+\t\t\t\"[ \t]*\\\\([^;]*)$\", 1 },\n+\t{ \"pascal\", \"^((procedure|function|constructor|\"\n+\t\t\t\"destructor|interface|implementation|\"\n+\t\t\t\"initialization|finalization)[ \\t]*.*)$\"\n+\t\t\t\"|\"\n+\t\t\t\"^(.*=[ \\t]*(class|record).*)$\",\n+\t\t\t1 },\n+\t{ \"php\", \"^[\\t ]*((function|class).*)\", 1 },\n+\t{ \"python\", \"^\\\\s*((class|def)\\\\s.*)$\", 1 },\n+\t{ \"ruby\", \"^\\\\s*((class|module|def)\\\\s.*)$\", 1 },\n+\t{ \"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\", 1 },\n };\n \n static const struct funcname_pattern_entry *funcname_pattern(const char *ident)\n-- \n1.6.0.1.244.gdc19\n"},{"id":"90986","messageId":"GDyYcKTaBR3x9PvTNoIdz93Z3xMLyTRKkKzkucPv-qhrm-KS_3c0QA@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil","subject":"[PATCH 4/4 v2] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T00:33:12Z","receivedAt":"2008-09-18T00:33:12Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nThe original version changed the cflags parameter from '0' to '1'\nrather than to the macro REG_EXTENDED as it should have been.\n\nThis version is corrected.\n\n-brandon\n\n\n diff.c |   35 ++++++++++++++++++-----------------\n 1 files changed, 18 insertions(+), 17 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex ad5e551..8018544 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1401,23 +1401,24 @@ static struct funcname_pattern_entry {\n \tconst char *pattern;\n \tconst int cflags;\n } builtin_funcname_pattern[] = {\n-\t{ \"bibtex\", \"\\\\(@[a-zA-Z]\\\\{1,\\\\}[ \\t]*{\\\\{0,1\\\\}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*\\\\).*$\", 0 },\n-\t{ \"html\", \"^\\\\s*\\\\(<[Hh][1-6]\\\\s.*>.*\\\\)$\", 0 },\n-\t{ \"java\", \"!^[ \t]*\\\\(catch\\\\|do\\\\|for\\\\|if\\\\|instanceof\\\\|\"\n-\t\t\t\"new\\\\|return\\\\|switch\\\\|throw\\\\|while\\\\)\\n\"\n-\t\t\t\"^[ \t]*\\\\(\\\\([ \t]*\"\n-\t\t\t\"[A-Za-z_][A-Za-z_0-9]*\\\\)\\\\{2,\\\\}\"\n-\t\t\t\"[ \t]*([^;]*\\\\)$\", 0 },\n-\t{ \"pascal\", \"^\\\\(\\\\(procedure\\\\|function\\\\|constructor\\\\|\"\n-\t\t\t\"destructor\\\\|interface\\\\|implementation\\\\|\"\n-\t\t\t\"initialization\\\\|finalization\\\\)[ \\t]*.*\\\\)$\"\n-\t\t\t\"\\\\|\"\n-\t\t\t\"^\\\\(.*=[ \\t]*\\\\(class\\\\|record\\\\).*\\\\)$\",\n-\t\t\t0 },\n-\t{ \"php\", \"^[\\t ]*\\\\(\\\\(function\\\\|class\\\\).*\\\\)\", 0 },\n-\t{ \"python\", \"^\\\\s*\\\\(\\\\(class\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n-\t{ \"ruby\", \"^\\\\s*\\\\(\\\\(class\\\\|module\\\\|def\\\\)\\\\s.*\\\\)$\", 0 },\n-\t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\", 0 },\n+\t{ \"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#\\\\}\\\\{~%]*).*$\", REG_EXTENDED },\n+\t{ \"html\", \"^\\\\s*(<[Hh][1-6]\\\\s.*>.*)$\", REG_EXTENDED },\n+\t{ \"java\", \"!^[ \t]*(catch|do|for|if|instanceof|\"\n+\t\t\t\"new|return|switch|throw|while)\\n\"\n+\t\t\t\"^[ \t]*(([ \t]*\"\n+\t\t\t\"[A-Za-z_][A-Za-z_0-9]*){2,}\"\n+\t\t\t\"[ \t]*\\\\([^;]*)$\", REG_EXTENDED },\n+\t{ \"pascal\", \"^((procedure|function|constructor|\"\n+\t\t\t\"destructor|interface|implementation|\"\n+\t\t\t\"initialization|finalization)[ \\t]*.*)$\"\n+\t\t\t\"|\"\n+\t\t\t\"^(.*=[ \\t]*(class|record).*)$\",\n+\t\t\tREG_EXTENDED },\n+\t{ \"php\", \"^[\\t ]*((function|class).*)\", REG_EXTENDED },\n+\t{ \"python\", \"^\\\\s*((class|def)\\\\s.*)$\", REG_EXTENDED },\n+\t{ \"ruby\", \"^\\\\s*((class|module|def)\\\\s.*)$\", REG_EXTENDED },\n+\t{ \"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n+\t\tREG_EXTENDED },\n };\n \n static const struct funcname_pattern_entry *funcname_pattern(const char *ident)\n-- \n1.6.0.1.244.gdc19\n"},{"id":"90987","messageId":"7vod2m1464.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"GZAEBf1BcP9-dznrIesxaE4Rb8bim6DpwDWCb9yWl99UVoQC9Dog0A@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-18T04:14:27Z","receivedAt":"2008-09-18T04:14:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> writes:\n\n> This is in preparation for allowing extended regular expression patterns.\n> ...\n> @@ -100,10 +100,11 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val\n>  static struct funcname_pattern {\n>  \tchar *name;\n>  \tchar *pattern;\n> +\tint cflags;\n\nWhat does \"C\" stand for?\n"},{"id":"90997","messageId":"48D1F80C.5030502@op5.se","threadId":"15410","inReplyTo":"7vod2m1464.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-18T06:41:16Z","receivedAt":"2008-09-18T06:41:16Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n> \n>> This is in preparation for allowing extended regular expression patterns.\n>> ...\n>> @@ -100,10 +100,11 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val\n>>  static struct funcname_pattern {\n>>  \tchar *name;\n>>  \tchar *pattern;\n>> +\tint cflags;\n> \n> What does \"C\" stand for?\n\n\n\"compile\". It's the same name as regcomp(3) uses for the flags being\nused to compile the regular expression. The full mnemonic name would\nbe regex_compile_flag, which is a bit unwieldy. Perhaps regcomp_flags\nwould be a good compromise?\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91005","messageId":"7vod2myljk.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"48D1F80C.5030502@op5.se","subject":"Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-18T07:12:47Z","receivedAt":"2008-09-18T07:12:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> Junio C Hamano wrote:\n> ...\n>>>  static struct funcname_pattern {\n>>>  \tchar *name;\n>>>  \tchar *pattern;\n>>> +\tint cflags;\n>>\n>> What does \"C\" stand for?\n>\n> \"compile\". It's the same name as regcomp(3) uses for the flags being\n> used to compile the regular expression. The full mnemonic name would\n> be regex_compile_flag, which is a bit unwieldy. Perhaps regcomp_flags\n> would be a good compromise?\n\nAh, I see.\n\nWhen I saw that new field for the first time, I didn't think it will be\nused to store the bare flag values regcomp/regexec library would accept\ndirectly (I expected we would see #define or enum to tweak our own set of\nfeatures, not limiting ourselves EXTENDED/ICASE etc. that regcomp/regexec\nlibrary supports)\n\nIOW, it just did not click for me to look at \"man 3 regcomp\" which says:\n\n    int regcomp(regex_t *preg, const char *regex, int cflags);\n\nSo unless others feel that we might get a better layering separation by\nnot storing REG_EXTENDED and stuff directly in that field (which was my\ninitial reaction without looking at 4/4 which does store REG_EXTENDED\nthere without our own enums), cflag is perfectly a good name here.\n\nThanks --- I am bit under the weather and not thinking quite straight.\n"},{"id":"91006","messageId":"48D200D7.9080800@op5.se","threadId":"15410","inReplyTo":"-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-18T07:18:47Z","receivedAt":"2008-09-18T07:18:47Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Brandon Casey wrote:\n> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n> ---\n> \n> \n> This is a blind conversion removing \\\\ before ( and { etc.\n> and adding \\\\ before naked ( and { etc.\n> \n> I hope the authors who last touched these patterns will help with testing:\n> \n> bibtex: Johan Herland\n>   html: Johan Herland\n>   java: Junio Hamano, Jeff King\n> pascal: Avery Pennarun\n>    php: Andreas Ericsson\n> python: Kirill Smelkov\n>   ruby: Giuseppe Bilotta\n>    tex: Johan Herland\n> \n\nThe PHP one seems to work just fine.\n\nSigned-off-by: Andreas Ericsson <ae@op5.se>\n\nNicely done, although I'd rather have \"ereg_funcname\" instead of\n\"xfuncname\", but I don't care very much for myself, as I'll\nrather submit my patterns upstream than add them to .git/config ;-)\n\nJunio:\nCan we issue a deprecation heads-up for the current \"funcname\"\nalong with a \"call for patterns\" and then have \"funcname\" and\n\"ereg_funcname\" mean the same for a while until we obsolete\nereg_funcname in favour of funcname, perhaps? I can't imagine\nanyone wanting to use posix regular expressions if extended\nones are available everywhere.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91009","messageId":"7vfxnxzz82.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"48D200D7.9080800@op5.se","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-18T07:31:57Z","receivedAt":"2008-09-18T07:31:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> Can we issue a deprecation heads-up for the current \"funcname\"\n> along with a \"call for patterns\" and then have \"funcname\" and\n> \"ereg_funcname\" mean the same for a while until we obsolete\n> ereg_funcname in favour of funcname, perhaps? I can't imagine\n> anyone wanting to use posix regular expressions if extended\n> ones are available everywhere.\n\nI prefer not to obsolete anything, and that is one of the larger reasons\nthat I did not object to xfuncname at all.  It's shorter to spell than\nereg_funcname (and sweeter to the eye).\n\nEven when in some future _everybody_ uses xfuncname and nobody you and I\nknow personally uses funcname anymore, I do not think it is worth the\nhassle to change the semantics of \"funcname\".\n\nFor one thing, \"xfuncname\" is _not_ that ugly that people would wish they\ncould spell it just \"funcname\".\n\nThis reminds me of what Eric did to \"commit\" vs \"dcommit\".  \"commit\" was\nrenamed to \"set-tree\", and a command with a better semantics is called\n\"dcommit\".  Perhaps not many people use \"set-tree\" and everybody keeps\ntyping \"dcommit\" these days, but it is not worth renaming it to \"commit\",\never.\n"},{"id":"91010","messageId":"48D20C04.1020703@op5.se","threadId":"15410","inReplyTo":"7vod2myljk.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-18T08:06:28Z","receivedAt":"2008-09-18T08:06:28Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Andreas Ericsson <ae@op5.se> writes:\n> \n>> Junio C Hamano wrote:\n>> ...\n>>>>  static struct funcname_pattern {\n>>>>  \tchar *name;\n>>>>  \tchar *pattern;\n>>>> +\tint cflags;\n>>> What does \"C\" stand for?\n>> \"compile\". It's the same name as regcomp(3) uses for the flags being\n>> used to compile the regular expression. The full mnemonic name would\n>> be regex_compile_flag, which is a bit unwieldy. Perhaps regcomp_flags\n>> would be a good compromise?\n> \n> Ah, I see.\n> \n> When I saw that new field for the first time, I didn't think it will be\n> used to store the bare flag values regcomp/regexec library would accept\n> directly (I expected we would see #define or enum to tweak our own set of\n> features, not limiting ourselves EXTENDED/ICASE etc. that regcomp/regexec\n> library supports)\n> \n> IOW, it just did not click for me to look at \"man 3 regcomp\" which says:\n> \n>     int regcomp(regex_t *preg, const char *regex, int cflags);\n> \n> So unless others feel that we might get a better layering separation by\n> not storing REG_EXTENDED and stuff directly in that field (which was my\n> initial reaction without looking at 4/4 which does store REG_EXTENDED\n> there without our own enums), cflag is perfectly a good name here.\n> \n\nI think it makes perfect sense to use whatever we pass when compiling\nthe regex. I wouldn't dare try to hack up something that pre-mangles\na regular expression and assume it gets it right everywhere anyway, so\nI'm quite happy with leaving it all to regcomp(3) and friends.\n\n\n> Thanks --- I am bit under the weather and not thinking quite straight.\n> \n\nMix 2cc's of 7yo Havana Club into a large cup of tea. Drink one such\ncup every hour and eat a fresh fruit with it. I haven't been ill a day\nin my life since I came up with that most excellent cure for absolutely\neverything. If nothing else, it makes it a bit less boring to be ill.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91012","messageId":"7vbpylzw9e.fsf@gitster.siamese.dyndns.org","threadId":"15410","inReplyTo":"48D20C04.1020703@op5.se","subject":"Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-18T08:35:57Z","receivedAt":"2008-09-18T08:35:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> Junio C Hamano wrote:\n>> Andreas Ericsson <ae@op5.se> writes:\n> ...\n> I think it makes perfect sense to use whatever we pass when compiling\n> the regex. I wouldn't dare try to hack up something that pre-mangles\n> a regular expression and assume it gets it right everywhere anyway, so\n> I'm quite happy with leaving it all to regcomp(3) and friends.\n\nOh, I never meant pre-mangling or anything funky like that.\n\nWhat I was envisioning we might want to make more flexible was what we\nbuild on top of regexp, such as the way how these multi-line stuff is\ntreated for example.  Currently more than one positive regexp concatenated\nwith \"\\n\" are ANDed together and the captured string from the last one is\nused, but it is plausible we might want to say \"first positive capturing\nmatch yields result for this pattern string\", or something like that.\n\n>> Thanks --- I am bit under the weather and not thinking quite straight.\n>\n> Mix 2cc's of 7yo Havana Club into a large cup of tea. Drink one such\n> cup every hour and eat a fresh fruit with it. I haven't been ill a day\n> in my life since I came up with that most excellent cure for absolutely\n> everything. If nothing else, it makes it a bit less boring to be ill.\n\nHeh, unfortunately I happen to live in the US.\n"},{"id":"91014","messageId":"200809181039.46954.johan@herland.net","threadId":"15410","inReplyTo":"-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-09-18T08:39:46Z","receivedAt":"2008-09-18T08:39:46Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Thursday 18 September 2008, Brandon Casey wrote:\n> This is a blind conversion removing \\\\ before ( and { etc.\n> and adding \\\\ before naked ( and { etc.\n>\n> I hope the authors who last touched these patterns will help with\n> testing:\n>\n> bibtex: Johan Herland\n\nThis was moved by Junio when he applied my patch; the line was originally \nwritten by Gustaf Hendeby in 23b5beb28fdadbb1d80ebf686a35385609f7a180\n\n>   html: Johan Herland\n\nWorks fine!\n\n>    tex: Johan Herland\n\nThis was moved by Junio when he applied my patch; the line was last \nrewritten by Giuseppe Bilotta in 807d86945336f676c9f650a6cbae9baa3191aaec\n\n\n...I just became a BIG fan of \"git gui blame\" ;)\n\n\nHave fun!\n\n...Johan\n\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"91019","messageId":"48D22A57.7070300@isy.liu.se","threadId":"15410","inReplyTo":"200809181039.46954.johan@herland.net","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Gustaf Hendeby","fromEmail":"hendeby@isy.liu.se","sentAt":"2008-09-18T10:15:51Z","receivedAt":"2008-09-18T10:15:51Z","isPatch":true,"sender":{"key":"hendeby@isy.liu.se","avatar":"https://avatars.githubusercontent.com/u/730316?v=4"},"body":"On 09/18/2008 10:39 AM, Johan Herland wrote:\n> On Thursday 18 September 2008, Brandon Casey wrote:\n>> This is a blind conversion removing \\\\ before ( and { etc.\n>> and adding \\\\ before naked ( and { etc.\n>>\n>> I hope the authors who last touched these patterns will help with\n>> testing:\n>>\n>> bibtex: Johan Herland\n> \n> This was moved by Junio when he applied my patch; the line was originally \n> written by Gustaf Hendeby in 23b5beb28fdadbb1d80ebf686a35385609f7a180\n\nI'm on the road the rest of this week and don't have access to a\nsuitable machine for testing until I get back.  Will put testing this on\nthe list of things to do for Monday.  The patch looks good, though, but\nI haven't actually tested it.\n\n/Gustaf\n"},{"id":"91020","messageId":"57518fd10809180353q2564d873k98e5f6d9041d0a7@mail.gmail.com","threadId":"15410","inReplyTo":"-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-09-18T10:53:48Z","receivedAt":"2008-09-18T10:53:48Z","isPatch":true,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On Thu, Sep 18, 2008 at 1:21 AM, Brandon Casey <casey@nrlssc.navy.mil> wrote:\n> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n> ---\n>\n>\n> This is a blind conversion removing \\\\ before ( and { etc.\n> and adding \\\\ before naked ( and { etc.\n>\n> I hope the authors who last touched these patterns will help with testing:\n\n\nNone of the patterns using \\\\s seem to work for me.  I had to replace\nthem with [ \\t] - is this a problem with the darwin regex\ncompatibility library or something?  I applied the patches on master\n(97d7fee2cb), and am running OS X 10.5.5.\n"},{"id":"91036","messageId":"ZteMrZlQ1K7uF4E4K_zDC1Gh4qMi2zZA1wWprVJjxcpiETKEn-YbiQ@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"57518fd10809180353q2564d873k98e5f6d9041d0a7@mail.gmail.com","subject":"Re: [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-18T15:48:54Z","receivedAt":"2008-09-18T15:48:54Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Jonathan del Strother wrote:\n> On Thu, Sep 18, 2008 at 1:21 AM, Brandon Casey <casey@nrlssc.navy.mil> wrote:\n>> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n>> ---\n>>\n>>\n>> This is a blind conversion removing \\\\ before ( and { etc.\n>> and adding \\\\ before naked ( and { etc.\n>>\n>> I hope the authors who last touched these patterns will help with testing:\n> \n> \n> None of the patterns using \\\\s seem to work for me.  I had to replace\n> them with [ \\t] - is this a problem with the darwin regex\n> compatibility library or something?  I applied the patches on master\n> (97d7fee2cb), and am running OS X 10.5.5.\n\nI was going to say possibly \\s is a gnu extension, but if by \"compatibility\nlibrary\", you mean compat/regex/regex.[ch] in the git source which is used\nby default now on OSX, then that _is_ the gnu library.\n\nI just tried the ruby pattern on IRIX6.5 and Solaris7 and \\\\s does not work.\nI am not using compat/regex/regex.[ch]. Same pattern works on linux.\n\nLooks like '\\\\s' needs to be changed to ' '.\n\n-brandon\n"},{"id":"91136","messageId":"UnIVj68wrBMolSCdIK6HiPbWuYW_tHaOLLRXg8Om13cHwLqzQ8QNNw@cipher.nrlssc.navy.mil","threadId":"15410","inReplyTo":"7vd4j212gb.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 3/4] diff.*.xfuncname which uses \"extended\" regex's for hunk header selection","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-09-19T18:14:51Z","receivedAt":"2008-09-19T18:14:51Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Junio C Hamano wrote:\n\n> I personally think it was a mistake that the loop returns failure when\n> there is any pattern that does not match (it is a useful feature that a\n> match with a negated one forces an early return, though).\n> \n> We may want to fix the semantics to be something like:\n> \n> \tfor (i = 0; i < regs->nr; i++) {\n>         \tstruct ff_reg *reg = &regs->array[i];\n>                 if (!regexec(&reg->re, line_buffer, 2, pmatch, 0)) {\n> \t\t\tif (reg->negate) {\n> \t                \tfree(line_buffer);\n> \t                \treturn -1;\n> \t\t\t}\n>                         break;\n> \t\t}\n> \t}\n>         if (regs->nr <= i) {\n>         \tfree(line_buffer);\n> \t\treturn -1;\n> \t}\n> \t... use pmatch() ...\n> \n> I.e. (1) negative match forces an early return (useful for catching\n> language keywords), (2) first positive match is used, and (3) no match is\n> a failure.\n> \n> Of course, by definition the above \"fix\" changes the semantics, and will\n> break people's existing setup if somebody has an existing custom pattern\n> string that does use more than one positive regexp anded together with\n> \"\\n\", but I somehow suspect nobody sane depends on the current broken\n> semantics.\n> \n> It would help making JdS's ObjC alternates easier to write.  You can say:\n> \n> \n> \t/* A or B */\n> \t\"...(A|B)$\"\n>         \"\\n\" /* or C or D */\n>         \"...(C|D)$\"\n> \n> and both captures around A|B and C|D would be saved in $1.\n\nJust to let you know another pair of eyes has given the above a\nonce over, I agree with your proposal. \"or\" semantics makes more sense\nthan \"and\".\n\n-brandon\n"}]}