* [PATCH 4/4] gitweb: No periods for error messages
@ 2006-08-04 22:16 Luben Tuikov
2006-08-05 0:20 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Luben Tuikov @ 2006-08-04 22:16 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 183 bytes --]
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
gitweb/gitweb.perl | 88 ++++++++++++++++++++++++++--------------------------
1 files changed, 44 insertions(+), 44 deletions(-)
[-- Attachment #2: 2013183029-p4.patch --]
[-- Type: application/octet-stream, Size: 11771 bytes --]
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 723823a..3731f4e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -76,7 +76,7 @@ our $action = $cgi->param('a');
if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
undef $action;
- die_error(undef, "Invalid action parameter.");
+ die_error(undef, "Invalid action parameter");
}
if ($action eq "opml") {
git_opml();
@@ -89,15 +89,15 @@ if (defined $project) {
$project =~ s|^/||; $project =~ s|/$||;
$project = validate_input($project);
if (!defined($project)) {
- die_error(undef, "Invalid project parameter.");
+ die_error(undef, "Invalid project parameter");
}
if (!(-d "$projectroot/$project")) {
undef $project;
- die_error(undef, "No such directory.");
+ die_error(undef, "No such directory");
}
if (!(-e "$projectroot/$project/HEAD")) {
undef $project;
- die_error(undef, "No such project.");
+ die_error(undef, "No such project");
}
$rss_link = "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
"$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>";
@@ -111,7 +111,7 @@ our $file_name = $cgi->param('f');
if (defined $file_name) {
$file_name = validate_input($file_name);
if (!defined($file_name)) {
- die_error(undef, "Invalid file parameter.");
+ die_error(undef, "Invalid file parameter");
}
}
@@ -119,7 +119,7 @@ our $hash = $cgi->param('h');
if (defined $hash) {
$hash = validate_input($hash);
if (!defined($hash)) {
- die_error(undef, "Invalid hash parameter.");
+ die_error(undef, "Invalid hash parameter");
}
}
@@ -127,7 +127,7 @@ our $hash_parent = $cgi->param('hp');
if (defined $hash_parent) {
$hash_parent = validate_input($hash_parent);
if (!defined($hash_parent)) {
- die_error(undef, "Invalid hash parent parameter.");
+ die_error(undef, "Invalid hash parent parameter");
}
}
@@ -135,7 +135,7 @@ our $hash_base = $cgi->param('hb');
if (defined $hash_base) {
$hash_base = validate_input($hash_base);
if (!defined($hash_base)) {
- die_error(undef, "Invalid hash base parameter.");
+ die_error(undef, "Invalid hash base parameter");
}
}
@@ -143,7 +143,7 @@ our $page = $cgi->param('pg');
if (defined $page) {
if ($page =~ m/[^0-9]$/) {
undef $page;
- die_error(undef, "Invalid page parameter.");
+ die_error(undef, "Invalid page parameter");
}
}
@@ -151,7 +151,7 @@ our $searchtext = $cgi->param('s');
if (defined $searchtext) {
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
undef $searchtext;
- die_error(undef, "Invalid search parameter.");
+ die_error(undef, "Invalid search parameter");
}
$searchtext = quotemeta $searchtext;
}
@@ -181,7 +181,7 @@ my %actions = (
$action = 'summary' if (!defined($action));
if (!defined($actions{$action})) {
undef $action;
- die_error(undef, "Unknown action.");
+ die_error(undef, "Unknown action");
}
$actions{$action}->();
exit;
@@ -427,7 +427,7 @@ sub git_get_hash_by_path {
my $tree = $base;
open my $fd, "-|", $GIT, "ls-tree", $base, "--", $path
- or die_error(undef, "Open git-ls-tree failed.");
+ or die_error(undef, "Open git-ls-tree failed");
my $line = <$fd>;
close $fd or return undef;
@@ -1274,13 +1274,13 @@ ## actions
sub git_project_list {
my $order = $cgi->param('o');
if (defined $order && $order !~ m/project|descr|owner|age/) {
- die_error(undef, "Invalid order parameter '$order'.");
+ die_error(undef, "Invalid order parameter '$order'");
}
my @list = git_read_projects();
my @projects;
if (!@list) {
- die_error(undef, "No projects found.");
+ die_error(undef, "No projects found");
}
foreach my $pr (@list) {
my $head = git_read_head($pr->{'path'});
@@ -1414,7 +1414,7 @@ sub git_summary {
"</table>\n";
open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_read_head($project)
- or die_error(undef, "Open git-rev-list failed.");
+ or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
git_header_div('shortlog');
@@ -1470,7 +1470,7 @@ sub git_tag {
sub git_blame2 {
my $fd;
my $ftype;
- die_error(undef, "Permission denied.") if (!git_get_project_config_bool ('blame'));
+ die_error(undef, "Permission denied") if (!git_get_project_config_bool ('blame'));
die_error('404 Not Found', "File name not defined") if (!$file_name);
$hash_base ||= git_read_head($project);
die_error(undef, "Reading commit failed") unless ($hash_base);
@@ -1485,7 +1485,7 @@ sub git_blame2 {
die_error("400 Bad Request", "object is not a blob");
}
open ($fd, "-|", $GIT, "blame", '-l', $file_name, $hash_base)
- or die_error(undef, "Open git-blame failed.");
+ or die_error(undef, "Open git-blame failed");
git_header_html();
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
@@ -1528,18 +1528,18 @@ sub git_blame2 {
sub git_blame {
my $fd;
- die_error('403 Permission denied', "Permission denied.") if (!git_get_project_config_bool ('blame'));
+ die_error('403 Permission denied', "Permission denied") if (!git_get_project_config_bool ('blame'));
die_error('404 Not Found', "What file will it be, master?") if (!$file_name);
$hash_base ||= git_read_head($project);
- die_error(undef, "Reading commit failed.") unless ($hash_base);
+ die_error(undef, "Reading commit failed") unless ($hash_base);
my %co = git_read_commit($hash_base)
- or die_error(undef, "Reading commit failed.");
+ or die_error(undef, "Reading commit failed");
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
- or die_error(undef, "Error lookup file.");
+ or die_error(undef, "Error lookup file");
}
open ($fd, "-|", $GIT, "annotate", '-l', '-t', '-r', $file_name, $hash_base)
- or die_error(undef, "Open git-annotate failed.");
+ or die_error(undef, "Open git-annotate failed");
git_header_html();
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
@@ -1649,9 +1649,9 @@ sub git_blob_plain {
if (defined $file_name) {
my $base = $hash_base || git_read_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file.");
+ or die_error(undef, "Error lookup file");
} else {
- die_error(undef, "No file name defined.");
+ die_error(undef, "No file name defined");
}
}
my $type = shift;
@@ -1682,14 +1682,14 @@ sub git_blob {
if (defined $file_name) {
my $base = $hash_base || git_read_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file.");
+ or die_error(undef, "Error lookup file");
} else {
- die_error(undef, "No file name defined.");
+ die_error(undef, "No file name defined");
}
}
my $have_blame = git_get_project_config_bool ('blame');
open my $fd, "-|", $GIT, "cat-file", "blob", $hash
- or die_error(undef, "Couldn't cat $file_name, $hash.");
+ or die_error(undef, "Couldn't cat $file_name, $hash");
my $mimetype = git_blob_plain_mimetype($fd, $file_name);
if ($mimetype !~ m/^text\//) {
close $fd;
@@ -1747,9 +1747,9 @@ sub git_tree {
}
$/ = "\0";
open my $fd, "-|", $GIT, "ls-tree", '-z', $hash
- or die_error(undef, "Open git-ls-tree failed.");
+ or die_error(undef, "Open git-ls-tree failed");
my @entries = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading tree failed.");
+ close $fd or die_error(undef, "Reading tree failed");
$/ = "\n";
my $refs = read_info_ref();
@@ -1828,7 +1828,7 @@ sub git_log {
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
- or die_error(undef, "Open git-rev-list failed.");
+ or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
@@ -1889,7 +1889,7 @@ sub git_log {
sub git_commit {
my %co = git_read_commit($hash);
if (!%co) {
- die_error(undef, "Unknown commit object.");
+ die_error(undef, "Unknown commit object");
}
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
@@ -1899,9 +1899,9 @@ sub git_commit {
$parent = "--root";
}
open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $parent, $hash
- or die_error(undef, "Open git-diff-tree failed.");
+ or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading git-diff-tree failed.");
+ close $fd or die_error(undef, "Reading git-diff-tree failed");
# non-textual hash id's can be cached
my $expires;
@@ -2117,15 +2117,15 @@ sub git_commitdiff {
mkdir($git_temp, 0700);
my %co = git_read_commit($hash);
if (!%co) {
- die_error(undef, "Unknown commit object.");
+ die_error(undef, "Unknown commit object");
}
if (!defined $hash_parent) {
$hash_parent = $co{'parent'};
}
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
- or die_error(undef, "Open git-diff-tree failed.");
+ or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading diff-tree failed.");
+ close $fd or die_error(undef, "Reading diff-tree failed");
# non-textual hash id's can be cached
my $expires;
@@ -2205,9 +2205,9 @@ sub git_commitdiff {
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
- or die_error(undef, "Open git-diff-tree failed.");
+ or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading diff-tree failed.");
+ close $fd or die_error(undef, "Reading diff-tree failed");
# try to figure out the next tag after this commit
my $tagname;
@@ -2265,7 +2265,7 @@ sub git_history {
my $ftype;
my %co = git_read_commit($hash_base);
if (!%co) {
- die_error(undef, "Unknown commit object.");
+ die_error(undef, "Unknown commit object");
}
my $refs = read_info_ref();
git_header_html();
@@ -2323,14 +2323,14 @@ sub git_history {
sub git_search {
if (!defined $searchtext) {
- die_error("", "Text field empty.");
+ die_error("", "Text field empty");
}
if (!defined $hash) {
$hash = git_read_head($project);
}
my %co = git_read_commit($hash);
if (!%co) {
- die_error(undef, "Unknown commit object.");
+ die_error(undef, "Unknown commit object");
}
# pickaxe may take all resources of your box and run for several minutes
# with every query - so decide by yourself how public you make this feature :)
@@ -2468,7 +2468,7 @@ sub git_shortlog {
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
- or die_error(undef, "Open git-rev-list failed.");
+ or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
@@ -2496,9 +2496,9 @@ ## feeds (RSS, OPML)
sub git_rss {
# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_read_head($project)
- or die_error(undef, "Open git-rev-list failed.");
+ or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading rev-list failed.");
+ close $fd or die_error(undef, "Reading rev-list failed");
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
"<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
--
1.4.2.rc3.g6df3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] gitweb: No periods for error messages
2006-08-04 22:16 [PATCH 4/4] gitweb: No periods for error messages Luben Tuikov
@ 2006-08-05 0:20 ` Junio C Hamano
2006-08-05 1:03 ` Luben Tuikov
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-08-05 0:20 UTC (permalink / raw)
To: Luben Tuikov; +Cc: git, Jakub Narebski
This and Jakub's [1/5] seem to be going the opposite way. I
tend to prefer ending each sentence with a full stop.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] gitweb: No periods for error messages
2006-08-05 0:20 ` Junio C Hamano
@ 2006-08-05 1:03 ` Luben Tuikov
2006-08-05 7:03 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Luben Tuikov @ 2006-08-05 1:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jakub Narebski
--- Junio C Hamano <junkio@cox.net> wrote:
> This and Jakub's [1/5] seem to be going the opposite way.
Not quite. They both do the same thing, except his patch
does it only half way:
- no full stop for error messages ending with some kind
of variable expansion.
- full stop for static error messages.
> I tend to prefer ending each sentence with a full stop.
I've never seen this in, among other things,
- kernel messages
- errno messages
- web server messages
- RFC text describing error messages, (web services),
- etc.
I was going for was consistency. I'd say apply Jacob's [6/5].
Luben
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] gitweb: No periods for error messages
2006-08-05 1:03 ` Luben Tuikov
@ 2006-08-05 7:03 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-08-05 7:03 UTC (permalink / raw)
To: Luben Tuikov; +Cc: git, Jakub Narebski
Luben Tuikov <ltuikov@yahoo.com> writes:
> --- Junio C Hamano <junkio@cox.net> wrote:
>
>> I tend to prefer ending each sentence with a full stop.
>
> I've never seen this in, among other things,
> - kernel messages
> - errno messages
> - web server messages
> - RFC text describing error messages, (web services),
> - etc.
Comparing
git grep \( -e die --or -e die \) --and -e '\."' -- '*.c'
and
git grep \( -e die --or -e die \) --and --not -e '\."' -- '*.c'
tells me that we omit periods, mostly.
> I was going for was consistency. I'd say apply Jacob's [6/5].
Well, [6/5] is on top of [1/5] which had the problem of
parroting unsanitized user input, so I'd rather use a clean
patch that does only this error message cleanups.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-05 7:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04 22:16 [PATCH 4/4] gitweb: No periods for error messages Luben Tuikov
2006-08-05 0:20 ` Junio C Hamano
2006-08-05 1:03 ` Luben Tuikov
2006-08-05 7:03 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).