{"thread":{"id":"10501","subject":"[PATCH] gitweb : disambiguate heads and tags withs the same name","startedAt":"2007-10-28T13:12:53Z","lastAt":"2007-11-03T21:40:32Z","messageCount":3,"participants":["Guillaume Seguin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"57424","messageId":"e877c31c0710280612l5d783ab0o50ce00c70b3311db@mail.gmail.com","threadId":"10501","inReplyTo":null,"subject":"[PATCH] gitweb : disambiguate heads and tags withs the same name","fromName":"Guillaume Seguin","fromEmail":"guillaume@segu.in","sentAt":"2007-10-28T13:12:53Z","receivedAt":"2007-10-28T13:12:53Z","isPatch":true,"sender":{"key":"guillaume@segu.in","avatar":null},"body":"Avoid wrong disambiguation that would link logs/trees of tags and heads which\nshare the same name to the same page, leading to a disambiguation that would\nprefer the tag, thus making it impossible to access the corresponding\nhead log and\ntree without hacking the url by hand.\n\n---\n gitweb/gitweb.perl |   14 ++++++++------\n 1 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 48e21da..f918c00 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3534,6 +3534,7 @@ sub git_tags_body {\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tmy $entry = $taglist->[$i];\n \t\tmy %tag = %$entry;\n+\t\tmy $name = \"refs/tags/$tag{'name'}\";\n \t\tmy $comment = $tag{'subject'};\n \t\tmy $comment_short;\n \t\tif (defined $comment) {\n@@ -3570,8 +3571,8 @@ sub git_tags_body {\n \t\t      \"<td class=\\\"link\\\">\" . \" | \" .\n \t\t      $cgi->a({-href => href(action=>$tag{'reftype'},\nhash=>$tag{'refid'})}, $tag{'reftype'});\n \t\tif ($tag{'reftype'} eq \"commit\") {\n-\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"shortlog\",\nhash=>$tag{'name'})}, \"shortlog\") .\n-\t\t\t      \" | \" . $cgi->a({-href => href(action=>\"log\",\nhash=>$tag{'name'})}, \"log\");\n+\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"shortlog\",\nhash=>$name)}, \"shortlog\") .\n+\t\t\t      \" | \" . $cgi->a({-href => href(action=>\"log\", hash=>$name)}, \"log\");\n \t\t} elsif ($tag{'reftype'} eq \"blob\") {\n \t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"blob_plain\",\nhash=>$tag{'refid'})}, \"raw\");\n \t\t}\n@@ -3597,6 +3598,7 @@ sub git_heads_body {\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tmy $entry = $headlist->[$i];\n \t\tmy %ref = %$entry;\n+\t\tmy $name = \"refs/heads/$ref{'name'}\";\n \t\tmy $curr = $ref{'id'} eq $head;\n \t\tif ($alternate) {\n \t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n@@ -3606,13 +3608,13 @@ sub git_heads_body {\n \t\t$alternate ^= 1;\n \t\tprint \"<td><i>$ref{'age'}</i></td>\\n\" .\n \t\t      ($curr ? \"<td class=\\\"current_head\\\">\" : \"<td>\") .\n-\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'name'}),\n+\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$name),\n \t\t               -class => \"list name\"},esc_html($ref{'name'})) .\n \t\t      \"</td>\\n\" .\n \t\t      \"<td class=\\\"link\\\">\" .\n-\t\t      $cgi->a({-href => href(action=>\"shortlog\",\nhash=>$ref{'name'})}, \"shortlog\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$ref{'name'})},\n\"log\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$ref{'name'},\nhash_base=>$ref{'name'})}, \"tree\") .\n+\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$name)},\n\"shortlog\") . \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$name)}, \"log\") . \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$name,\nhash_base=>$name)}, \"tree\") .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\";\n \t}\n-- \n1.5.3.4.395.g85b0\n"},{"id":"57588","messageId":"7v3avsmpmj.fsf@gitster.siamese.dyndns.org","threadId":"10501","inReplyTo":"e877c31c0710280612l5d783ab0o50ce00c70b3311db@mail.gmail.com","subject":"Re: [PATCH] gitweb : disambiguate heads and tags withs the same name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-30T18:19:48Z","receivedAt":"2007-10-30T18:19:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Guillaume Seguin\" <guillaume@segu.in> writes:\n\n> Avoid wrong disambiguation that would link logs/trees of tags and heads which\n> share the same name to the same page, leading to a disambiguation that would\n> prefer the tag, thus making it impossible to access the corresponding\n> head log and\n> tree without hacking the url by hand.\n>\n> ---\n>  gitweb/gitweb.perl |   14 ++++++++------\n>  1 files changed, 8 insertions(+), 6 deletions(-)\n>\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 48e21da..f918c00 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -3534,6 +3534,7 @@ sub git_tags_body {\n>  \tfor (my $i = $from; $i <= $to; $i++) {\n>  \t\tmy $entry = $taglist->[$i];\n>  \t\tmy %tag = %$entry;\n> +\t\tmy $name = \"refs/tags/$tag{'name'}\";\n>  \t\tmy $comment = $tag{'subject'};\n>  \t\tmy $comment_short;\n>  \t\tif (defined $comment) {\n> @@ -3570,8 +3571,8 @@ sub git_tags_body {\n>  \t\t      \"<td class=\\\"link\\\">\" . \" | \" .\n>  \t\t      $cgi->a({-href => href(action=>$tag{'reftype'},\n> hash=>$tag{'refid'})}, $tag{'reftype'});\n>  \t\tif ($tag{'reftype'} eq \"commit\") {\n> -\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"shortlog\",\n> hash=>$tag{'name'})}, \"shortlog\") .\n> -\t\t\t      \" | \" . $cgi->a({-href => href(action=>\"log\",\n> hash=>$tag{'name'})}, \"log\");\n> +\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"shortlog\",\n> hash=>$name)}, \"shortlog\") .\n> ...\n\nJust in case anybody is wondering, the patch is whitespace\nmangled and lacks a sign-off.\n\nI suspect what the patch does may be a good idea, although I\nhaven't followed the existing code closely to verify it.\n"},{"id":"58181","messageId":"1194126032.15420.4.camel@ed3n-m","threadId":"10501","inReplyTo":"7v3avsmpmj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] gitweb : disambiguate heads and tags withs the same name","fromName":"Guillaume Seguin","fromEmail":"guillaume@segu.in","sentAt":"2007-11-03T21:40:32Z","receivedAt":"2007-11-03T21:40:32Z","isPatch":true,"sender":{"key":"guillaume@segu.in","avatar":null},"body":"   Avoid wrong disambiguation that would link logs/trees of tags and heads which \n   share the same name to the same page, leading to a disambiguation that would\n   prefer the tag, thus making it impossible to access the corresponding\n   head log and tree without hacking the url by hand.\n\n   Signed-off-by: Guillaume Seguin <guillaume@segu.in>\n\n---\n gitweb/gitweb.perl |   14 ++++++++------\n 1 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl \nindex 48e21da..f918c00 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3534,6 +3534,7 @@ sub git_tags_body {\n     for (my $i = $from; $i <= $to; $i++) {\n         my $entry = $taglist->[$i]; \n         my %tag = %$entry;\n+        my $name = \"refs/tags/$tag{'name'}\";\n         my $comment = $tag{'subject'};\n         my $comment_short;\n         if (defined $comment) {\n@@ -3570,8 +3571,8 @@ sub git_tags_body { \n               \"<td class=\\\"link\\\">\" . \" | \" .\n               $cgi->a({-href => href(action=>$tag{'reftype'}, hash=>$tag{'refid'})}, $tag{'reftype'}); \n         if ($tag{'reftype'} eq \"commit\") {\n-            print \" | \" . $cgi->a({-href => href(action=>\"shortlog\", hash=>$tag{'name'})}, \"shortlog\") . \n-                  \" | \" . $cgi->a({-href => href(action=>\"log\", hash=>$tag{'name'})}, \"log\");\n+            print \" | \" . $cgi->a({-href => href(action=>\"shortlog\", hash=>$name)}, \"shortlog\") . \n+                  \" | \" . $cgi->a({-href => href(action=>\"log\", hash=>$name)}, \"log\");\n         } elsif ($tag{'reftype'} eq \"blob\") {\n             print \" | \" . $cgi->a({-href => href(action=>\"blob_plain\", hash=>$tag{'refid'})}, \"raw\"); \n         }\n@@ -3597,6 +3598,7 @@ sub git_heads_body {\n     for (my $i = $from; $i <= $to; $i++) {\n         my $entry = $headlist->[$i];\n         my %ref = %$entry;\n+        my $name = \"refs/heads/$ref{'name'}\"; \n         my $curr = $ref{'id'} eq $head;\n         if ($alternate) {\n             print \"<tr class=\\\"dark\\\">\\n\";\n@@ -3606,13 +3608,13 @@ sub git_heads_body {\n         $alternate ^= 1; \n         print \"<td><i>$ref{'age'}</i></td>\\n\" .\n               ($curr ? \"<td class=\\\"current_head\\\">\" : \"<td>\") .\n-              $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'name'}), \n+              $cgi->a({-href => href(action=>\"shortlog\", hash=>$name),\n                        -class => \"list name\"},esc_html($ref{'name'})) .\n               \"</td>\\n\" . \n               \"<td class=\\\"link\\\">\" .\n-              $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'name'})}, \"shortlog\") . \" | \" . \n-              $cgi->a({-href => href(action=>\"log\", hash=>$ref{'name'})}, \"log\") . \" | \" .\n-              $cgi->a({-href => href(action=>\"tree\", hash=>$ref{'name'}, hash_base=>$ref{'name'})}, \"tree\") . \n+              $cgi->a({-href => href(action=>\"shortlog\", hash=>$name)}, \"shortlog\") . \" | \" .\n+              $cgi->a({-href => href(action=>\"log\", hash=>$name)}, \"log\") . \" | \" . \n+              $cgi->a({-href => href(action=>\"tree\", hash=>$name, hash_base=>$name)}, \"tree\") .\n               \"</td>\\n\" .\n               \"</tr>\"; \n     }\n-- \n1.5.3.4.395.g85b0\n"}]}