{"thread":{"id":"6227","subject":"Bugs in gitweb","startedAt":"2007-01-05T01:29:20Z","lastAt":"2007-01-09T23:35:31Z","messageCount":17,"participants":["Luben Tuikov","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"30848","messageId":"100171.86639.qm@web31814.mail.mud.yahoo.com","threadId":"6227","inReplyTo":null,"subject":"Bugs in gitweb","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-05T01:29:20Z","receivedAt":"2007-01-05T01:29:20Z","isPatch":false,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"gitweb has two bugs in git_patchset_body (now you know who\nyou are without data-mining with git-blame).\n\nThe first bug is a missing \"</div>\" on commitdiff.\nSaw this one a couple of days ago, but was swamped\nand had no time to post.\n\nThe second bug is displaying a renamed file with the\nsame name as the one of the preceding \"patch\". Saw\nthis one today when I pulled.\n\nTo exhibit these, you need to \"commitdiff\" a commit\nwhich has at least one rename and at least one regular\ndiff preceding the rename.\n\nCan the guilty parties (you know who you are) please\nfix this.\n\n\"And while at it\" can you please actually *do* \"refactor\"\ngit_patchset_body *into smaller functions each one doing\na single particular task*.\n\nIt is sad to see git_patchset_body in such despicable state\nall the while seeing words like \"refactor\" in the commit logs\nof that function.\n\ngit_patchset_body is grossly overloaded for what it is\nsupposed to do to, and being one single huge blob, it is\nhard to maintain.\n\nThanks,\n    Luben\n"},{"id":"30994","messageId":"1168134747394-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:22Z","receivedAt":"2007-01-07T01:52:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n\n> gitweb has two bugs in git_patchset_body (now you know who\n> you are without data-mining with git-blame).\n> \n> The first bug is a missing \"</div>\" on commitdiff.\n> Saw this one a couple of days ago, but was swamped\n> and had no time to post.\n\nCould you please provide either minimal example from\nscratch, or parameters for git.git repository view, or\nan URL? I could not reproduce this...\n\n> The second bug is displaying a renamed file with the\n> same name as the one of the preceding \"patch\". Saw\n> this one today when I pulled.\n> \n> To exhibit these, you need to \"commitdiff\" a commit\n> which has at least one rename and at least one regular\n> diff preceding the rename.\n\nHaven't found this one, but I hope one of those patches\nwould fix this.\n\n[...]\n> \"And while at it\" can you please actually *do* \"refactor\"\n> git_patchset_body *into smaller functions each one doing\n> a single particular task*.\n> \n> It is sad to see git_patchset_body in such despicable state\n> all the while seeing words like \"refactor\" in the commit logs\n> of that function.\n\n(Perhaps I overuse word \"refactor\").\n\n> git_patchset_body is grossly overloaded for what it is\n> supposed to do to, and being one single huge blob, it is\n> hard to maintain.\n\nI'm not sure if splitting git_patchset_body into smaller functions\nwould be worth doing, as 1) such functions would be used only\nby git_patchset_body, 2) quite I bit of info has to be passed.\n\n-- >8 --\n\nTable of contents\n [PATCH 1/5] gitweb: Fix error in git_patchest_body for file\n             creation/deletion patch \n [PATCH 2/5] gitweb: Fix error in \"rename to\"/\"copy to\" git diff\n             header output \n [PATCH 3/5] gitweb: Fix errors in git_patchset_body for empty patches\n [PATCH 4/5] Revert \"gitweb: There can be empty patches\n             (in git_patchset_body)\"\n [PATCH 5/5] gitweb: Fix split patches output (e.g. file to symlink)\n\nDiffstat:\n gitweb/gitweb.perl |   22 ++++++++++++++--------\n 1 files changed, 14 insertions(+), 8 deletions(-)\n\n-- \nJakub Narebski\nPoland\n"},{"id":"30992","messageId":"1168134751748-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 1/5] gitweb: Fix error in git_patchest_body for file creation/deletion patch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:23Z","receivedAt":"2007-01-07T01:52:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"$from_id, $to_id variables should be local per PATCH.\n\nFix error in git_patchset_body for file creation (deletion) patches,\nwhere instead of /dev/null as from-file (to-file) diff header line, it\nhad link to previous file with current file name.  This error occured\nonly if there was another patch before file creation (deletion) patch.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nLuben Tuikov wrote:\n\n> The second bug is displaying a renamed file with the\n> same name as the one of the preceding \"patch\". Saw\n> this one today when I pulled.\n> \n> To exhibit these, you need to \"commitdiff\" a commit\n> which has at least one rename and at least one regular\n> diff preceding the rename.\n\nI think this should also fix this bug.\n\n gitweb/gitweb.perl |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7906280..04c8015 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2378,7 +2378,6 @@ sub git_patchset_body {\n \tmy $patch_line;\n \tmy $diffinfo;\n \tmy (%from, %to);\n-\tmy ($from_id, $to_id);\n \n \tprint \"<div class=\\\"patchset\\\">\\n\";\n \n@@ -2392,6 +2391,7 @@ sub git_patchset_body {\n  PATCH:\n \twhile ($patch_line) {\n \t\tmy @diff_header;\n+\t\tmy ($from_id, $to_id);\n \n \t\t# git diff header\n \t\t#assert($patch_line =~ m/^diff /) if DEBUG;\n@@ -2439,11 +2439,15 @@ sub git_patchset_body {\n \t\t\t\t$from{'href'} = href(action=>\"blob\", hash_base=>$hash_parent,\n \t\t\t\t                     hash=>$diffinfo->{'from_id'},\n \t\t\t\t                     file_name=>$from{'file'});\n+\t\t\t} else {\n+\t\t\t\tdelete $from{'href'};\n \t\t\t}\n \t\t\tif ($diffinfo->{'status'} ne \"D\") { # not deleted file\n \t\t\t\t$to{'href'} = href(action=>\"blob\", hash_base=>$hash,\n \t\t\t\t                   hash=>$diffinfo->{'to_id'},\n \t\t\t\t                   file_name=>$to{'file'});\n+\t\t\t} else {\n+\t\t\t\tdelete $to{'href'};\n \t\t\t}\n \t\t\t# this is first patch for raw difftree line with $patch_idx index\n \t\t\t# we index @$difftree array from 0, but number patches from 1\n-- \n1.4.4.3\n"},{"id":"30993","messageId":"11681347522258-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 2/5] gitweb: Fix error in \"rename to\"/\"copy to\" git diff header output","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:24Z","receivedAt":"2007-01-07T01:52:24Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Fix error in git_patchset_body subroutine, which caused \"rename to\"/\"copy\nto\" line in extended diff header to be displayed incorrectly.\n\nWhile at it, fix align.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nStupid typu: was '=' instead of '.='.\n\n gitweb/gitweb.perl |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 04c8015..1b4a4c0 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2479,11 +2479,11 @@ sub git_patchset_body {\n \t\t\t# match <path>\n \t\t\tif ($patch_line =~ s!^((copy|rename) from ).*$!$1! && $from{'href'}) {\n \t\t\t\t$patch_line .= $cgi->a({-href=>$from{'href'}, -class=>\"path\"},\n-\t\t\t\t                        esc_path($from{'file'}));\n+\t\t\t\t                       esc_path($from{'file'}));\n \t\t\t}\n \t\t\tif ($patch_line =~ s!^((copy|rename) to ).*$!$1! && $to{'href'}) {\n-\t\t\t\t$patch_line = $cgi->a({-href=>$to{'href'}, -class=>\"path\"},\n-\t\t\t\t                      esc_path($to{'file'}));\n+\t\t\t\t$patch_line .= $cgi->a({-href=>$to{'href'}, -class=>\"path\"},\n+\t\t\t\t                       esc_path($to{'file'}));\n \t\t\t}\n \t\t\t# match <mode>\n \t\t\tif ($patch_line =~ m/\\s(\\d{6})$/) {\n-- \n1.4.4.3\n"},{"id":"30995","messageId":"11681347531023-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 3/5] gitweb: Fix errors in git_patchset_body for empty patches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:25Z","receivedAt":"2007-01-07T01:52:25Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"We now do not skip over empty patches in git_patchset_body (where\nempty means that they consist only of git diff header, and of extended\ndiff header, for example \"pure rename\" patch).  This means that after\nextended diff header there can be next patch (i.e. /^diff /) or end of\npatchset, and not necessary patch body (i.e. /^--- /).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 1b4a4c0..7ebdfbb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2403,7 +2403,7 @@ sub git_patchset_body {\n \t\twhile ($patch_line = <$fd>) {\n \t\t\tchomp $patch_line;\n \n-\t\t\tlast EXTENDED_HEADER if ($patch_line =~ m/^--- /);\n+\t\t\tlast EXTENDED_HEADER if ($patch_line =~ m/^--- |^diff /);\n \n \t\t\tif ($patch_line =~ m/^index ([0-9a-fA-F]{40})..([0-9a-fA-F]{40})/) {\n \t\t\t\t$from_id = $1;\n@@ -2522,6 +2522,8 @@ sub git_patchset_body {\n \n \t\t# from-file/to-file diff header\n \t\t$patch_line = $last_patch_line;\n+\t\tlast PATCH unless $patch_line;\n+\t\tnext PATCH if ($patch_line =~ m/^diff /);\n \t\t#assert($patch_line =~ m/^---/) if DEBUG;\n \t\tif ($from{'href'}) {\n \t\t\t$patch_line = '--- a/' .\n-- \n1.4.4.3\n"},{"id":"30996","messageId":"11681347532843-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 4/5] Revert \"gitweb: There can be empty patches (in git_patchset_body)\"","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:26Z","receivedAt":"2007-01-07T01:52:26Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"This reverts commit 1ebb948f656c03a5bdaab4de1a113b9ffcb98bea,\nas that patch quieted warning but was not proper solution.\nThe previous commit was.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7ebdfbb..d60d7c6 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2533,7 +2533,7 @@ sub git_patchset_body {\n \t\tprint \"<div class=\\\"diff from_file\\\">$patch_line</div>\\n\";\n \n \t\t$patch_line = <$fd>;\n-\t\tlast PATCH unless $patch_line;\n+\t\t#last PATCH unless $patch_line;\n \t\tchomp $patch_line;\n \n \t\t#assert($patch_line =~ m/^+++/) if DEBUG;\n-- \n1.4.4.3\n"},{"id":"30997","messageId":"11681347551377-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"100171.86639.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH 5/5] gitweb: Fix split patches output (e.g. file to symlink)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T01:52:27Z","receivedAt":"2007-01-07T01:52:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Do not replace /dev/null in two-line from-file/to-file diff header for\nsplit patches (\"split\" patch mean more than one patch per one\ndiff-tree raw line) by a/file or b/file link.\n\nSplit patches differ from pair of deletion/creation patch in git diff\nheader: both a/file and b/file are hyperlinks, in all patches in a\nsplit.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d60d7c6..f46a422 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2525,7 +2525,7 @@ sub git_patchset_body {\n \t\tlast PATCH unless $patch_line;\n \t\tnext PATCH if ($patch_line =~ m/^diff /);\n \t\t#assert($patch_line =~ m/^---/) if DEBUG;\n-\t\tif ($from{'href'}) {\n+\t\tif ($from{'href'} && $patch_line =~ m!^--- \"?a/!) {\n \t\t\t$patch_line = '--- a/' .\n \t\t\t              $cgi->a({-href=>$from{'href'}, -class=>\"path\"},\n \t\t\t                      esc_path($from{'file'}));\n@@ -2537,7 +2537,7 @@ sub git_patchset_body {\n \t\tchomp $patch_line;\n \n \t\t#assert($patch_line =~ m/^+++/) if DEBUG;\n-\t\tif ($to{'href'}) {\n+\t\tif ($to{'href'} && $patch_line =~ m!^\\+\\+\\+ \"?b/!) {\n \t\t\t$patch_line = '+++ b/' .\n \t\t\t              $cgi->a({-href=>$to{'href'}, -class=>\"path\"},\n \t\t\t                      esc_path($to{'file'}));\n-- \n1.4.4.3\n"},{"id":"31117","messageId":"257061.93025.qm@web31801.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"1168134747394-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-08T03:50:27Z","receivedAt":"2007-01-08T03:50:27Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> Luben Tuikov wrote:\n> \n> > gitweb has two bugs in git_patchset_body (now you know who\n> > you are without data-mining with git-blame).\n> > \n> > The first bug is a missing \"</div>\" on commitdiff.\n> > Saw this one a couple of days ago, but was swamped\n> > and had no time to post.\n> \n> Could you please provide either minimal example from\n> scratch, or parameters for git.git repository view, or\n> an URL? I could not reproduce this...\n\nI cannot post a URL to the repo for many reasons.\nI don't have time to allocate to trying to define a test\ncase from scratch, nor am I certain that I can attain that,\nsince that would be a trivial bug to fix and am sure that\nit would've been caught.  But as a heavy git user in a complex\n(git) environment, the limits and corner cases are sometimes hit.\n\nI cannot suggest anything other than using git professionally\nin a complex environment, as opposed to being a pastime.\n\nI also understand that it is a fine line of separating the two,\nand it would appear that the former group not always has the time\nand the latter not always has the complex environment to hit\nthe corner cases.\n\n> > The second bug is displaying a renamed file with the\n> > same name as the one of the preceding \"patch\". Saw\n> > this one today when I pulled.\n> > \n> > To exhibit these, you need to \"commitdiff\" a commit\n> > which has at least one rename and at least one regular\n> > diff preceding the rename.\n> \n> Haven't found this one, but I hope one of those patches\n> would fix this.\n\nI hope so too.\n\n> > \"And while at it\" can you please actually *do* \"refactor\"\n> > git_patchset_body *into smaller functions each one doing\n> > a single particular task*.\n> > \n> > It is sad to see git_patchset_body in such despicable state\n> > all the while seeing words like \"refactor\" in the commit logs\n> > of that function.\n> \n> (Perhaps I overuse word \"refactor\").\n\nPerhaps.  Or maybe it is used incorrectly.\n\n> > git_patchset_body is grossly overloaded for what it is\n> > supposed to do to, and being one single huge blob, it is\n> > hard to maintain.\n> \n> I'm not sure if splitting git_patchset_body into smaller functions\n> would be worth doing, as 1) such functions would be used only\n> by git_patchset_body, 2) quite I bit of info has to be passed.\n\nWhen things get too complex, they should be done out of\nprinciple, not out of \"how I feel about it\", since principles\ncan be proved and what they define can be easily tracked.\n\nYes, it is worth doing.  It doesn't matter that those smaller\nfunctions would be used only by git_patchset_body, when\n(by principle) the workings, logic and justification would\nbe clearly exposed by those smaller units of function.  Thus\nit would be possible to prove that the function is correct\nor not, and bugs would be able to be isolated easily.\n\nSmaller units of function should do one thing and do it well.\nIf you cannot isolate them \"because quite a bit of info has\nto be passed\" then the logic of git_patchset_body is faulty,\nby _definition_, and needs to be scrapped and re-engineered\n(from scratch).\n\n   Luben\n"},{"id":"31118","messageId":"601528.75484.qm@web31805.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"1168134751748-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 1/5] gitweb: Fix error in git_patchest_body for file creation/deletion patch","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-08T03:53:41Z","receivedAt":"2007-01-08T03:53:41Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n\n> $from_id, $to_id variables should be local per PATCH.\n\nThere. You've already refactored the logic, now pull it into\na separate function.\n\nBTW, I'll try the patches (unless Junio commits them to \"next\"\nfirst) Monday sometime.\n\n    Luben\n"},{"id":"31125","messageId":"200701081003.54991.jnareb@gmail.com","threadId":"6227","inReplyTo":"257061.93025.qm@web31801.mail.mud.yahoo.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-08T09:03:54Z","receivedAt":"2007-01-08T09:03:54Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia poniedziałek 8. stycznia 2007 04:50, Luben Tuikov napisał:\n> --- Jakub Narebski <jnareb@gmail.com> wrote:\n>> Luben Tuikov wrote:\n\n>>> \"And while at it\" can you please actually *do* \"refactor\"\n>>> git_patchset_body *into smaller functions each one doing\n>>> a single particular task*.\n>>> \n>>> It is sad to see git_patchset_body in such despicable state\n>>> all the while seeing words like \"refactor\" in the commit logs\n>>> of that function.\n>> \n>> (Perhaps I overuse word \"refactor\").\n> \n> Perhaps.  Or maybe it is used incorrectly.\n\nThat is also possible.\n\nThat said git_patchset_body was rewritten from AWK-like event-driven\nsingle loop, with lots of state variables, to few loops following\nthe structure of patchset, and of git diff.\n\n>>> git_patchset_body is grossly overloaded for what it is\n>>> supposed to do to, and being one single huge blob, it is\n>>> hard to maintain.\n>> \n>> I'm not sure if splitting git_patchset_body into smaller functions\n>> would be worth doing, as 1) such functions would be used only\n>> by git_patchset_body, 2) quite a bit of info has to be passed.\n> \n> When things get too complex, they should be done out of\n> principle, not out of \"how I feel about it\", since principles\n> can be proved and what they define can be easily tracked.\n> \n> Yes, it is worth doing.  It doesn't matter that those smaller\n> functions would be used only by git_patchset_body, when\n> (by principle) the workings, logic and justification would\n> be clearly exposed by those smaller units of function.  Thus\n> it would be possible to prove that the function is correct\n> or not, and bugs would be able to be isolated easily.\n> \n> Smaller units of function should do one thing and do it well.\n> If you cannot isolate them \"because quite a bit of info has\n> to be passed\" then the logic of git_patchset_body is faulty,\n> by _definition_, and needs to be scrapped and re-engineered\n> (from scratch).\n\nOn first glance it would be easy to separate (refactor) individual\npatch parsing and output into separate subroutine; perhaps also\nseparate parsing and output of diff header.\n\nThe problems with this approach are two: empty patches (e.g. pure\nrename patch) and split patches (e.g. file to symlink patch).\nAnd we are dealing with two sources of information: \"raw\" difftree\npart, and the patch(set) part.\n\nSo it is not that easy. But I can certainly try...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"31189","messageId":"351088.61033.qm@web31801.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"1168134747394-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-09T04:25:25Z","receivedAt":"2007-01-09T04:25:25Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\nThat saved me time having to manually apply them.\n\nNow, the results are that I see the same bug.\n\ngitweb and gitcore as reported by the xml header\nis 1.4.4.4.g7c5d, which is \"next\" as of a few minutes\nago, merged over twice into my branchA and branchB\n(names changed).\n\nThe commit that fails looks is the attachment\nwith names and contents changed to protect the\ninnocent.\n\nThe complaint Firefox 2.0.0.1 says is the err.txt\nfile attached.\n\n    Luben\n\n\n\n\nXML Parsing Error: mismatched tag. Expected: </div>.\nLocation: http://lion.vitesse.com/git/?p=vhal.git;a=commitdiff;h=b4e81df5f58bc24bb690b5b3687fd36180e071b8;hp=bd5f8325508ee5151d84d65f50b72fd7f3ecc77a\nLine Number 95, Column 3:\n\n</body>\n--^\n\n\n$ git-diff-tree -r --no-commit-id --patch-with-raw --full-index b4e81df5f58bc24bb690b5b3687fd36180e071b8 > /tmp/diff.txt\n\n:100644 100644 a4bf8891fc1153946b2d1531fdfe09f53a532c65 28929eb48708d0bc33d4c80c4349e753332ea4e1 M\tfileA\n:000000 100644 0000000000000000000000000000000000000000 36dec28bfc5ec04cff264fd1b7c4b47ab7bad3e3 A\tfileB\n:100644 000000 36dec28bfc5ec04cff264fd1b7c4b47ab7bad3e3 0000000000000000000000000000000000000000 D\tfileC\n\ndiff --git a/fileA b/fileA\nindex a4bf8891fc1153946b2d1531fdfe09f53a532c65..28929eb48708d0bc33d4c80c4349e753332ea4e1 100644\n--- a/fileA\n+++ b/fileA\n@@ -1,6 +1,6 @@\n\n... one line change ...\n\ndiff --git a/fileB b/fileB\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..36dec28bfc5ec04cff264fd1b7c4b47ab7bad3e3\n--- /dev/null\n+++ b/fileB\n@@ -0,0 +1,89 @@\n\n... it is obvious what happened here ...\n\ndiff --git a/fileC b/fileC\ndeleted file mode 100644\nindex 36dec28bfc5ec04cff264fd1b7c4b47ab7bad3e3..0000000000000000000000000000000000000000\n--- a/fileC\n+++ /dev/null\n@@ -1,89 +0,0 @@\n\n... again it is obvious what happened here ...\n\n"},{"id":"31222","messageId":"200701091127.01930.jnareb@gmail.com","threadId":"6227","inReplyTo":"351088.61033.qm@web31801.mail.mud.yahoo.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-09T10:27:01Z","receivedAt":"2007-01-09T10:27:01Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n\n> Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n> That saved me time having to manually apply them.\n> \n> Now, the results are that I see the same bug.\n \n(The same bug = no closing div).\n\nI'll try to reproduce this.\n\n\nWhat about the other error, \n\n>>> The second bug is displaying a renamed file with the\n>>> same name as the one of the preceding \"patch\". Saw\n>>> this one today when I pulled.\n\nIs it corrected by those patches?\n-- \nJakub Narebski\nPoland\n"},{"id":"31258","messageId":"200701091744.46729.jnareb@gmail.com","threadId":"6227","inReplyTo":"200701091127.01930.jnareb@gmail.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-09T16:44:46Z","receivedAt":"2007-01-09T16:44:46Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n> Luben Tuikov wrote:\n> \n>> Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n>> That saved me time having to manually apply them.\n>> \n>> Now, the results are that I see the same bug.\n>  \n> (The same bug = no closing div).\n> \n> I'll try to reproduce this.\n\nI failed to reproduce this error.\n\nCould you apply the following patch, and report the result of\n  grep \"</div>\\|<div\" | grep -v \"<div.*</div>\n(find all opening and closing <div> elements, but omitting\nthose which are opened and closed in the same line)?\n\n-- >8 --\ngitweb: Mark closing </div>'s in code and output\n    \nAdd Perl comments and HTML comments (<!-- ... -->) to </div> output,\nto mark which 'div' element the closing </div> corresponds to.\n    \nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n\n gitweb/gitweb.perl |   81 ++++++++++++++++++++++++++-------------------------\n 1 files changed, 41 insertions(+), 40 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 25e5079..7b6cb4c 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1800,14 +1800,14 @@ EOF\n \t\t      $cgi->hidden(-name => \"a\") . \"\\n\" .\n \t\t      $cgi->hidden(-name => \"h\") . \"\\n\" .\n \t\t      $cgi->popup_menu(-name => 'st', -default => 'commit',\n-\t\t\t\t       -values => ['commit', 'author', 'committer', 'pickaxe']) .\n+\t\t                       -values => ['commit', 'author', 'committer', 'pickaxe']) .\n \t\t      $cgi->sup($cgi->a({-href => href(action=>\"search_help\")}, \"?\")) .\n \t\t      \" search:\\n\",\n \t\t      $cgi->textfield(-name => \"s\", -value => $searchtext) . \"\\n\" .\n-\t\t      \"</div>\" .\n+\t\t      \"</div><!-- search -->\\n\" . # class=\"search\"\n \t\t      $cgi->end_form() . \"\\n\";\n \t}\n-\tprint \"</div>\\n\";\n+\tprint \"</div><!-- page_header -->\\n\"; # class=\"page_header\"\n }\n \n sub git_footer_html {\n@@ -1827,7 +1827,7 @@ sub git_footer_html {\n \t\tprint $cgi->a({-href => href(project=>undef, action=>\"project_index\"),\n \t\t              -class => \"rss_logo\"}, \"TXT\") . \"\\n\";\n \t}\n-\tprint \"</div>\\n\" ;\n+\tprint \"</div><!-- page_footer -->\\n\" ; # class=\"page_footer\"\n \n \tif (-f $site_footer) {\n \t\topen (my $fd, $site_footer);\n@@ -1849,7 +1849,7 @@ sub die_error {\n <br /><br />\n $status - $error\n <br />\n-</div>\n+</div><!-- page_body -->\n EOF\n \tgit_footer_html();\n \texit;\n@@ -1887,7 +1887,7 @@ sub git_print_page_nav {\n \t\t       $_ : $cgi->a({-href => href(%{$arg{$_}})}, \"$_\")\n \t\t } @navs);\n \tprint \"<br/>\\n$extra<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\t      \"</div><!-- page_nav -->\\n\"; # class=\"page_nav\"\n }\n \n sub format_paging_nav {\n@@ -1934,7 +1934,7 @@ sub git_print_header_div {\n \tprint \"<div class=\\\"header\\\">\\n\" .\n \t      $cgi->a({-href => href(%args), -class => \"title\"},\n \t      $title ? $title : $action) .\n-\t      \"\\n</div>\\n\";\n+\t      \"\\n</div><!-- header -->\\n\"; # class=\"header\"\n }\n \n #sub git_print_authorship (\\%) {\n@@ -1952,7 +1952,7 @@ sub git_print_authorship {\n \t\tprintf(\" (%02d:%02d %s)\",\n \t\t       $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});\n \t}\n-\tprint \"]</div>\\n\";\n+\tprint \"]</div>\\n\"; # class=\"author_date\"\n }\n \n sub git_print_page_path {\n@@ -1990,7 +1990,7 @@ sub git_print_page_path {\n \t\t\tprint esc_path($basename);\n \t\t}\n \t}\n-\tprint \"<br/></div>\\n\";\n+\tprint \"<br/></div><!-- page_path -->\\n\"; # class=\"page_path\"\n }\n \n # sub git_print_log (\\@;%) {\n@@ -2188,7 +2188,7 @@ sub git_difftree_body {\n \tif ($#{$difftree} > 10) {\n \t\tprint(($#{$difftree} + 1) . \" files changed:\\n\");\n \t}\n-\tprint \"</div>\\n\";\n+\tprint \"</div><!-- list_head -->\\n\"; # class=\"list_head\"\n \n \tprint \"<table class=\\\"diff_tree\\\">\\n\";\n \tmy $alternate = 1;\n@@ -2518,7 +2518,8 @@ sub git_patchset_body {\n \t\t\t}\n \t\t\tprint $patch_line . \"<br/>\\n\";\n \t\t}\n-\t\tprint \"</div>\\n\"  if (@diff_header > 0); # class=\"diff extended_header\"\n+\t\tprint \"</div><!-- diff extended_header -->\\n\"\n+\t\t\tif (@diff_header > 0); # class=\"diff extended_header\"\n \n \t\t# from-file/to-file diff header\n \t\t$patch_line = $last_patch_line;\n@@ -2555,10 +2556,10 @@ sub git_patchset_body {\n \t\t}\n \n \t} continue {\n-\t\tprint \"</div>\\n\"; # class=\"patch\"\n+\t\tprint \"</div><!-- patch $patch_idx -->\\n\"; # class=\"patch\"\n \t}\n \n-\tprint \"</div>\\n\"; # class=\"patchset\"\n+\tprint \"</div><!-- patchset -->\\n\"; # class=\"patchset\"\n }\n \n # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n@@ -2971,7 +2972,7 @@ sub git_project_list {\n \t\topen (my $fd, $home_text);\n \t\tprint <$fd>;\n \t\tclose $fd;\n-\t\tprint \"</div>\\n\";\n+\t\tprint \"</div><!-- index_include -->\\n\"; # class=\"index_include\"\n \t}\n \tgit_project_list_body(\\@list, $order);\n \tgit_footer_html();\n@@ -3123,14 +3124,14 @@ sub git_tag {\n \t\t\t\"</td></tr>\\n\";\n \t}\n \tprint \"</table>\\n\\n\" .\n-\t      \"</div>\\n\";\n+\t      \"</div><!-- title_text -->\\n\"; # class=\"title_text\"\n \tprint \"<div class=\\\"page_body\\\">\";\n \tmy $comment = $tag{'comment'};\n \tforeach my $line (@$comment) {\n \t\tchomp $line;\n \t\tprint esc_html($line, -nbsp=>1) . \"<br/>\\n\";\n \t}\n-\tprint \"</div>\\n\";\n+\tprint \"</div><!-- page_body -->\\n\"; # class=\"page_body\"\n \tgit_footer_html();\n }\n \n@@ -3201,7 +3202,7 @@ HTML\n \t\tmy $rev = substr($full_rev, 0, 8);\n \t\tmy $author = $meta->{'author'};\n \t\tmy %date = parse_date($meta->{'author-time'},\n-\t\t\t\t      $meta->{'author-tz'});\n+\t\t                      $meta->{'author-tz'});\n \t\tmy $date = $date{'iso-tz'};\n \t\tif ($group_size) {\n \t\t\t$current_color = ++$current_color % $num_colors;\n@@ -3213,9 +3214,9 @@ HTML\n \t\t\tprint \" rowspan=\\\"$group_size\\\"\" if ($group_size > 1);\n \t\t\tprint \">\";\n \t\t\tprint $cgi->a({-href => href(action=>\"commit\",\n-\t\t\t\t\t\t     hash=>$full_rev,\n-\t\t\t\t\t\t     file_name=>$file_name)},\n-\t\t\t\t      esc_html($rev));\n+\t\t\t                             hash=>$full_rev,\n+\t\t\t                             file_name=>$file_name)},\n+\t\t\t              esc_html($rev));\n \t\t\tprint \"</td>\\n\";\n \t\t}\n \t\topen (my $dd, \"-|\", git_cmd(), \"rev-parse\", \"$full_rev^\")\n@@ -3224,19 +3225,19 @@ HTML\n \t\tclose $dd;\n \t\tchomp($parent_commit);\n \t\tmy $blamed = href(action => 'blame',\n-\t\t\t\t  file_name => $meta->{'filename'},\n-\t\t\t\t  hash_base => $parent_commit);\n+\t\t                  file_name => $meta->{'filename'},\n+\t\t                  hash_base => $parent_commit);\n \t\tprint \"<td class=\\\"linenr\\\">\";\n \t\tprint $cgi->a({ -href => \"$blamed#l$orig_lineno\",\n-\t\t\t\t-id => \"l$lineno\",\n-\t\t\t\t-class => \"linenr\" },\n-\t\t\t      esc_html($lineno));\n+\t\t                -id => \"l$lineno\",\n+\t\t                -class => \"linenr\" },\n+\t\t              esc_html($lineno));\n \t\tprint \"</td>\";\n \t\tprint \"<td class=\\\"pre\\\">\" . esc_html($data) . \"</td>\\n\";\n \t\tprint \"</tr>\\n\";\n \t}\n \tprint \"</table>\\n\";\n-\tprint \"</div>\";\n+\tprint \"</div><!-- page_body -->\\n\"; # class=\"page_body\"\n \tclose $fd\n \t\tor print \"Reading blob failed\\n\";\n \tgit_footer_html();\n@@ -3335,7 +3336,7 @@ HTML\n \tprint \"</table>\\n\\n\";\n \tclose $fd\n \t\tor print \"Reading blob failed.\\n\";\n-\tprint \"</div>\";\n+\tprint \"</div><!-- page_body -->\"; # class=\"page_body\"\n \tgit_footer_html();\n }\n \n@@ -3465,7 +3466,7 @@ sub git_blob {\n \t\tgit_print_header_div('commit', esc_html($co{'title'}), $hash_base);\n \t} else {\n \t\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t\t      \"<br/><br/></div>\\n\" .\n+\t\t      \"<br/><br/></div>\\n\" . # class=\"page_nav\"\n \t\t      \"<div class=\\\"title\\\">$hash</div>\\n\";\n \t}\n \tgit_print_page_path($file_name, \"blob\", $hash_base);\n@@ -3491,7 +3492,7 @@ sub git_blob {\n \t}\n \tclose $fd\n \t\tor print \"Reading blob failed.\\n\";\n-\tprint \"</div>\";\n+\tprint \"</div><!-- page_body -->\"; # class=\"page_body\"\n \tgit_footer_html();\n }\n \n@@ -3542,7 +3543,7 @@ sub git_tree {\n \t} else {\n \t\tundef $hash_base;\n \t\tprint \"<div class=\\\"page_nav\\\">\\n\";\n-\t\tprint \"<br/><br/></div>\\n\";\n+\t\tprint \"<br/><br/></div>\\n\"; # class=\"page_nav\"\n \t\tprint \"<div class=\\\"title\\\">$hash</div>\\n\";\n \t}\n \tif (defined $file_name) {\n@@ -3594,7 +3595,7 @@ sub git_tree {\n \t\tprint \"</tr>\\n\";\n \t}\n \tprint \"</table>\\n\" .\n-\t      \"</div>\";\n+\t      \"</div><!-- page_body -->\"; # class=\"page_body\";\n \tgit_footer_html();\n }\n \n@@ -3671,19 +3672,19 @@ sub git_log {\n \t\t      \" | \" .\n \t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$commit, hash_base=>$commit)}, \"tree\") .\n \t\t      \"<br/>\\n\" .\n-\t\t      \"</div>\\n\" .\n+\t\t      \"</div><!-- log_link -->\\n\" . # class=\"log_link\"\n \t\t      \"<i>\" . esc_html($co{'author_name'}) .  \" [$ad{'rfc2822'}]</i><br/>\\n\" .\n-\t\t      \"</div>\\n\";\n+\t\t      \"</div><!-- title_text -->\\n\";  # class=\"title_text\"\n \n \t\tprint \"<div class=\\\"log_body\\\">\\n\";\n \t\tgit_print_log($co{'comment'}, -final_empty_line=> 1);\n-\t\tprint \"</div>\\n\";\n+\t\tprint \"</div><!-- log_body -->\\n\"; # class=\"log_body\"\n \t}\n \tif ($#commitlist >= 100) {\n \t\tprint \"<div class=\\\"page_nav\\\">\\n\";\n \t\tprint $cgi->a({-href => href(action=>\"log\", hash=>$hash, page=>$page+1),\n \t\t\t       -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n-\t\tprint \"</div>\\n\";\n+\t\tprint \"</div><!-- page_nav -->\\n\"; # class=\"page_nav\"\n \t}\n \tgit_footer_html();\n }\n@@ -3808,11 +3809,11 @@ sub git_commit {\n \t\t      \"</tr>\\n\";\n \t}\n \tprint \"</table>\".\n-\t      \"</div>\\n\";\n+\t      \"</div><!-- title_text -->\\n\"; # class=\"title_text\"\n \n \tprint \"<div class=\\\"page_body\\\">\\n\";\n \tgit_print_log($co{'comment'});\n-\tprint \"</div>\\n\";\n+\tprint \"</div><!-- page_body -->\\n\"; # class=\"page_body\"\n \n \tif (@$parents <= 1) {\n \t\t# do not output difftree/whatchanged for merges\n@@ -4018,7 +4019,7 @@ sub git_blobdiff {\n \t\tgit_patchset_body($fd, [ \\%diffinfo ], $hash_base, $hash_parent_base);\n \t\tclose $fd;\n \n-\t\tprint \"</div>\\n\"; # class=\"page_body\"\n+\t\tprint \"</div><!-- page_body -->\\n\"; # class=\"page_body\"\n \t\tgit_footer_html();\n \n \t} else {\n@@ -4140,7 +4141,7 @@ sub git_commitdiff {\n \t\tif (@{$co{'comment'}} > 1) {\n \t\t\tprint \"<div class=\\\"log\\\">\\n\";\n \t\t\tgit_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1);\n-\t\t\tprint \"</div>\\n\"; # class=\"log\"\n+\t\t\tprint \"</div><!-- log -->\\n\"; # class=\"log\"\n \t\t}\n \n \t} elsif ($format eq 'plain') {\n@@ -4175,7 +4176,7 @@ TEXT\n \n \t\tgit_patchset_body($fd, \\@difftree, $hash, $hash_parent);\n \t\tclose $fd;\n-\t\tprint \"</div>\\n\"; # class=\"page_body\"\n+\t\tprint \"</div><!-- page_body -->\\n\"; # class=\"page_body\"\n \t\tgit_footer_html();\n \n \t} elsif ($format eq 'plain') {\n\n\n-- \nJakub Narebski\nPoland\n"},{"id":"31280","messageId":"772754.41694.qm@web31805.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"200701091127.01930.jnareb@gmail.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-09T20:54:48Z","receivedAt":"2007-01-09T20:54:48Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> Luben Tuikov wrote:\n> \n> > Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n> > That saved me time having to manually apply them.\n> > \n> > Now, the results are that I see the same bug.\n>  \n> (The same bug = no closing div).\n> \n> I'll try to reproduce this.\n> \n> \n> What about the other error, \n> \n> >>> The second bug is displaying a renamed file with the\n> >>> same name as the one of the preceding \"patch\". Saw\n> >>> this one today when I pulled.\n> \n> Is it corrected by those patches?\n\nYes, the second bug is corrected by your patches.\nThe first one still stands.\n\n    Luben\n"},{"id":"31289","messageId":"734286.71437.qm@web31814.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"200701091744.46729.jnareb@gmail.com","subject":"Re: [PATCH 0/5] gitweb: git_patchset_body fixes","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-09T21:38:25Z","receivedAt":"2007-01-09T21:38:25Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> Jakub Narebski wrote:\n> > Luben Tuikov wrote:\n> > \n> >> Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n> >> That saved me time having to manually apply them.\n> >> \n> >> Now, the results are that I see the same bug.\n> >  \n> > (The same bug = no closing div).\n> > \n> > I'll try to reproduce this.\n> \n> I failed to reproduce this error.\n> \n> Could you apply the following patch, and report the result of\n>   grep \"</div>\\|<div\" | grep -v \"<div.*</div>\n> (find all opening and closing <div> elements, but omitting\n> those which are opened and closed in the same line)?\n\n<div class=\"page_header\">\n<div class=\"search\">\n</div><!-- search -->\n</div><!-- page_header -->\n<div class=\"page_nav\">\n</div><!-- page_nav -->\n<div class=\"header\">\n</div><!-- header -->\n<div class=\"page_body\">\n<div class=\"log\">\n</div><!-- log -->\n<div class=\"list_head\">\n</div><!-- list_head -->\n<div class=\"patchset\">\n<div class=\"patch\" id=\"patch1\">\n<div class=\"diff extended_header\">\n</div><!-- diff extended_header -->\n</div><!-- patch 0 -->\n<div class=\"patch\" id=\"patch2\">\n<div class=\"diff extended_header\">\n</div><!-- diff extended_header -->\n</div><!-- patchset -->\n</div><!-- page_body -->\n<div class=\"page_footer\">\n</div><!-- page_footer -->\n\nThe bug is clear.\n\n     Luben\n"},{"id":"31301","messageId":"11683840631010-git-send-email-jnareb@gmail.com","threadId":"6227","inReplyTo":"734286.71437.qm@web31814.mail.mud.yahoo.com","subject":"[PATCH] gitweb: Fix git_patchset_body not closing <div class=\"patch\">","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-09T23:07:43Z","receivedAt":"2007-01-09T23:07:43Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Fix case when git_patchset_body didn't close <div class=\"patch\">,\nfor patchsets with last patch empty.\n\nperlsyn(1):\n  The \"last\" command immediately exits the loop in question.\n  The \"continue\" block, if any, is not executed.\n\nRemove some commented out code in git_patchset_body.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n\nLuben Tuikov wrote:\n> --- Jakub Narebski <jnareb@gmail.com> wrote:\n>> Jakub Narebski wrote:\n>>> Luben Tuikov wrote:\n>>> \n>>>> Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n>>>> That saved me time having to manually apply them.\n>>>> \n>>>> Now, the results are that I see the same bug.\n>>>  \n>>> (The same bug = no closing div).\n>>> \n>>> I'll try to reproduce this.\n>> \n>> I failed to reproduce this error.\n>> \n>> Could you apply the following patch, and report the result of\n>>   grep \"</div>\\|<div\" | grep -v \"<div.*</div>\n>> (find all opening and closing <div> elements, but omitting\n>> those which are opened and closed in the same line)?\n\n[...] \n> <div class=\"patchset\">\n> <div class=\"patch\" id=\"patch1\">\n> <div class=\"diff extended_header\">\n> </div><!-- diff extended_header -->\n> </div><!-- patch 0 -->\n> <div class=\"patch\" id=\"patch2\">\n> <div class=\"diff extended_header\">\n> </div><!-- diff extended_header -->\n> </div><!-- patchset -->\n[...] \n> The bug is clear.\n\nOops. I'm bit new to Perl.\n\nThis should fix it.\n\n gitweb/gitweb.perl |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 25e5079..88af2e6 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2412,7 +2412,6 @@ sub git_patchset_body {\n \n \t\t\tpush @diff_header, $patch_line;\n \t\t}\n-\t\t#last PATCH unless $patch_line;\n \t\tmy $last_patch_line = $patch_line;\n \n \t\t# check if current patch belong to current raw line\n@@ -2522,7 +2521,10 @@ sub git_patchset_body {\n \n \t\t# from-file/to-file diff header\n \t\t$patch_line = $last_patch_line;\n-\t\tlast PATCH unless $patch_line;\n+\t\tif (! $patch_line) {\n+\t\t\tprint \"</div>\\n\"; # class=\"patch\"\n+\t\t\tlast PATCH;\n+\t\t}\n \t\tnext PATCH if ($patch_line =~ m/^diff /);\n \t\t#assert($patch_line =~ m/^---/) if DEBUG;\n \t\tif ($from{'href'} && $patch_line =~ m!^--- \"?a/!) {\n@@ -2533,7 +2535,6 @@ sub git_patchset_body {\n \t\tprint \"<div class=\\\"diff from_file\\\">$patch_line</div>\\n\";\n \n \t\t$patch_line = <$fd>;\n-\t\t#last PATCH unless $patch_line;\n \t\tchomp $patch_line;\n \n \t\t#assert($patch_line =~ m/^+++/) if DEBUG;\n-- \n1.4.4.3\n"},{"id":"31305","messageId":"189181.35429.qm@web31811.mail.mud.yahoo.com","threadId":"6227","inReplyTo":"11683840631010-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Fix git_patchset_body not closing <div class=\"patch\">","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2007-01-09T23:35:31Z","receivedAt":"2007-01-09T23:35:31Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n\n> Fix case when git_patchset_body didn't close <div class=\"patch\">,\n> for patchsets with last patch empty.\n> \n> perlsyn(1):\n>   The \"last\" command immediately exits the loop in question.\n>   The \"continue\" block, if any, is not executed.\n> \n> Remove some commented out code in git_patchset_body.\n> \n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\nAcked-by: Luben Tuikov <ltuikov@yahoo.com>\n\nThis patch fixes it.\n\n    Luben\n\n\n> ---\n> \n> Luben Tuikov wrote:\n> > --- Jakub Narebski <jnareb@gmail.com> wrote:\n> >> Jakub Narebski wrote:\n> >>> Luben Tuikov wrote:\n> >>> \n> >>>> Ok, I see that Junio has committed the fixes to \"next\" -- thanks!\n> >>>> That saved me time having to manually apply them.\n> >>>> \n> >>>> Now, the results are that I see the same bug.\n> >>>  \n> >>> (The same bug = no closing div).\n> >>> \n> >>> I'll try to reproduce this.\n> >> \n> >> I failed to reproduce this error.\n> >> \n> >> Could you apply the following patch, and report the result of\n> >>   grep \"</div>\\|<div\" | grep -v \"<div.*</div>\n> >> (find all opening and closing <div> elements, but omitting\n> >> those which are opened and closed in the same line)?\n> \n> [...] \n> > <div class=\"patchset\">\n> > <div class=\"patch\" id=\"patch1\">\n> > <div class=\"diff extended_header\">\n> > </div><!-- diff extended_header -->\n> > </div><!-- patch 0 -->\n> > <div class=\"patch\" id=\"patch2\">\n> > <div class=\"diff extended_header\">\n> > </div><!-- diff extended_header -->\n> > </div><!-- patchset -->\n> [...] \n> > The bug is clear.\n> \n> Oops. I'm bit new to Perl.\n> \n> This should fix it.\n> \n>  gitweb/gitweb.perl |    7 ++++---\n>  1 files changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 25e5079..88af2e6 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2412,7 +2412,6 @@ sub git_patchset_body {\n>  \n>  \t\t\tpush @diff_header, $patch_line;\n>  \t\t}\n> -\t\t#last PATCH unless $patch_line;\n>  \t\tmy $last_patch_line = $patch_line;\n>  \n>  \t\t# check if current patch belong to current raw line\n> @@ -2522,7 +2521,10 @@ sub git_patchset_body {\n>  \n>  \t\t# from-file/to-file diff header\n>  \t\t$patch_line = $last_patch_line;\n> -\t\tlast PATCH unless $patch_line;\n> +\t\tif (! $patch_line) {\n> +\t\t\tprint \"</div>\\n\"; # class=\"patch\"\n> +\t\t\tlast PATCH;\n> +\t\t}\n>  \t\tnext PATCH if ($patch_line =~ m/^diff /);\n>  \t\t#assert($patch_line =~ m/^---/) if DEBUG;\n>  \t\tif ($from{'href'} && $patch_line =~ m!^--- \"?a/!) {\n> @@ -2533,7 +2535,6 @@ sub git_patchset_body {\n>  \t\tprint \"<div class=\\\"diff from_file\\\">$patch_line</div>\\n\";\n>  \n>  \t\t$patch_line = <$fd>;\n> -\t\t#last PATCH unless $patch_line;\n>  \t\tchomp $patch_line;\n>  \n>  \t\t#assert($patch_line =~ m/^+++/) if DEBUG;\n> -- \n> 1.4.4.3\n> \n> \n"}]}