{"thread":{"id":"5411","subject":"[PATCH 2/2] gitweb: Remove git_to_hash function","startedAt":"2006-08-27T21:43:14Z","lastAt":"2006-08-31T19:32:45Z","messageCount":5,"participants":["Jakub Narebski","Junio C Hamano","Dennis Stosberg"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"26004","messageId":"200608272343.14653.jnareb@gmail.com","threadId":"5411","inReplyTo":null,"subject":"[PATCH 0/2] gitweb: Get rid of failed experiments ;-)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-27T21:43:14Z","receivedAt":"2006-08-27T21:43:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Remove unused subroutines or subroutines which don't work correctly from \ngitweb.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"26003","messageId":"200608272344.38542.jnareb@gmail.com","threadId":"5411","inReplyTo":"200608272343.14653.jnareb@gmail.com","subject":"[PATCH 1/2] gitweb: Remove unused git_get_{preceding,following}_references","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-27T21:44:38Z","receivedAt":"2006-08-27T21:44:38Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Remove unused (and with errors in implementation)\ngit_get_{preceding,following}_references subroutines.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   51 ---------------------------------------------------\n 1 files changed, 0 insertions(+), 51 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ba5024a..6918947 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -784,57 +784,6 @@ sub git_get_references {\n \treturn \\%refs;\n }\n \n-sub git_get_following_references {\n-\tmy $hash = shift || return undef;\n-\tmy $type = shift;\n-\tmy $base = shift || $hash_base || \"HEAD\";\n-\n-\tmy $refs = git_get_references($type);\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $base\n-\t\tor return undef;\n-\tmy @commits = map { chomp; $_ } <$fd>;\n-\tclose $fd\n-\t\tor return undef;\n-\n-\tmy @reflist;\n-\tmy $lastref;\n-\n-\tforeach my $commit (@commits) {\n-\t\tforeach my $ref (@{$refs->{$commit}}) {\n-\t\t\t$lastref = $ref;\n-\t\t\tpush @reflist, $lastref;\n-\t\t}\n-\t\tif ($commit eq $hash) {\n-\t\t\tlast;\n-\t\t}\n-\t}\n-\n-\treturn wantarray ? @reflist : $lastref;\n-}\n-\n-sub git_get_preceding_references {\n-\tmy $hash = shift || return undef;\n-\tmy $type = shift;\n-\n-\tmy $refs = git_get_references($type);\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $hash\n-\t\tor return undef;\n-\tmy @commits = map { chomp; $_ } <$fd>;\n-\tclose $fd\n-\t\tor return undef;\n-\n-\tmy @reflist;\n-\n-\tforeach my $commit (@commits) {\n-\t\tforeach my $ref (@{$refs->{$commit}}) {\n-\t\t\treturn $ref unless wantarray;\n-\t\t\tpush @reflist, $ref;\n-\t\t}\n-\t}\n-\n-\treturn @reflist;\n-}\n-\n sub git_get_rev_name_tags {\n \tmy $hash = shift || return undef;\n \n-- \n1.4.1.1\n"},{"id":"26002","messageId":"200608272345.26722.jnareb@gmail.com","threadId":"5411","inReplyTo":"200608272343.14653.jnareb@gmail.com","subject":"[PATCH 2/2] gitweb: Remove git_to_hash function","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-27T21:45:26Z","receivedAt":"2006-08-27T21:45:26Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Remove git_to_hash function, which was to translate symbolic reference\nto hash, and it's use in git_blobdiff.  We don't try so hard to guess\nfilename if it was not provided.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   27 +++------------------------\n 1 files changed, 3 insertions(+), 24 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 99c74f1..ae18c27 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -635,26 +635,6 @@ sub git_get_hash_by_path {\n \treturn $3;\n }\n \n-# converts symbolic name to hash\n-sub git_to_hash {\n-\tmy @params = @_;\n-\treturn undef unless @params;\n-\n-\topen my $fd, \"-|\", $GIT, \"rev-parse\", @params\n-\t\tor return undef;\n-\tmy @hashes = map { chomp; $_ } <$fd>;\n-\tclose $fd;\n-\n-\tif (wantarray) {\n-\t\treturn @hashes;\n-\t} elsif (scalar(@hashes) == 1) {\n-\t\t# single hash\n-\t\treturn $hashes[0];\n-\t} else {\n-\t\treturn \\@hashes;\n-\t}\n-}\n-\n ## ......................................................................\n ## git utility functions, directly accessing git repository\n \n@@ -2739,10 +2719,9 @@ sub git_blobdiff {\n \t\t\t@difftree\n \t\t\t\tor die_error('404 Not Found', \"Blob diff not found\");\n \n-\t\t} elsif (defined $hash) { # try to find filename from $hash\n-\t\t\tif ($hash !~ /[0-9a-fA-F]{40}/) {\n-\t\t\t\t$hash = git_to_hash($hash);\n-\t\t\t}\n+\t\t} elsif (defined $hash &&\n+\t\t         $hash =~ /[0-9a-fA-F]{40}/) {\n+\t\t\t# try to find filename from $hash\n \n \t\t\t# read filtered raw output\n \t\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts, $hash_parent_base, $hash_base\n-- \n1.4.1.1\n"},{"id":"26011","messageId":"7vac5px1ic.fsf@assigned-by-dhcp.cox.net","threadId":"5411","inReplyTo":"200608272343.14653.jnareb@gmail.com","subject":"Re: [PATCH 0/2] gitweb: Get rid of failed experiments ;-)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-27T22:22:19Z","receivedAt":"2006-08-27T22:22:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Remove unused subroutines or subroutines which don't work correctly from \n> gitweb.\n\nI'll apply both, thanks.  [2/2] had a fuzz at the very end of\nthe second hunk (your base version do not have -M to diff-tree\nparameter anymore) but that was easy to deal with.\n\nAlso thanks for the reminder about \"typo in git_patchset_body\".\n"},{"id":"26157","messageId":"20060831193245.G22a7ca6b@leonov.stosberg.net","threadId":"5411","inReplyTo":"7vac5px1ic.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] gitweb: Remove forgotten call to git_to_hash","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-31T19:32:45Z","receivedAt":"2006-08-31T19:32:45Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"On Aug 27th, Jakub Narebski sent a patch which removed the git_to_hash()\nfunction and this call to it. The patch did not apply cleanly and had to\nbe applied manually. Removing the last chunk has obviously been forgotten.\n\nSee: commit  0aea33762b1262d11fb43eda9f3fc152b5622cca and\n     message <200608272345.26722.jnareb@gmail.com>\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\n---\n gitweb/gitweb.perl |    4 ----\n 1 files changed, 0 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 9324d71..68f40bd 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2778,10 +2778,6 @@ sub git_blobdiff {\n \t\t\t@difftree\n \t\t\t\tor die_error('404 Not Found', \"Blob diff not found\");\n \n-\t\t} elsif (defined $hash) { # try to find filename from $hash\n-\t\t\tif ($hash !~ /[0-9a-fA-F]{40}/) {\n-\t\t\t\t$hash = git_to_hash($hash);\n-\t\t\t}\n \t\t} elsif (defined $hash &&\n \t\t         $hash =~ /[0-9a-fA-F]{40}/) {\n \t\t\t# try to find filename from $hash\n-- \n1.4.2\n"}]}