* [PATCH 5/9] gitweb: Cleanup and uniquify error messages
From: Jakub Narebski @ 2006-08-05 11:12 UTC (permalink / raw)
To: git
In-Reply-To: <44d47813.36251c31.2553.3cf7@mx.gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.perl | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6f3f465..8773a8d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1464,7 +1464,7 @@ sub git_blame2 {
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);
+ die_error(undef, "Couldn't find base commit.") unless ($hash_base);
my %co = git_read_commit($hash_base)
or die_error(undef, "Reading commit failed");
if (!defined $hash) {
@@ -1473,7 +1473,7 @@ sub git_blame2 {
}
$ftype = git_get_type($hash);
if ($ftype !~ "blob") {
- die_error("400 Bad Request", "object is not a blob");
+ 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.");
@@ -1520,9 +1520,9 @@ sub git_blame2 {
sub git_blame {
my $fd;
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);
+ 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);
+ die_error(undef, "Couldn't find base commit.") unless ($hash_base);
my %co = git_read_commit($hash_base)
or die_error(undef, "Reading commit failed.");
if (!defined $hash) {
@@ -2113,7 +2113,7 @@ sub git_commitdiff {
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
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 git-diff-tree failed.");
# non-textual hash id's can be cached
my $expires;
@@ -2484,7 +2484,7 @@ sub git_rss {
open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_read_head($project)
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 git-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.1.1
^ permalink raw reply related
* [PATCH 9/9] gitweb: Inline $rss_link
From: Jakub Narebski @ 2006-08-05 11:18 UTC (permalink / raw)
To: git
In-Reply-To: <44d47813.36251c31.2553.3cf7@mx.gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Does anyone set $rss_link variable?
gitweb/gitweb.perl | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2e1a2ba..57f7198 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -21,7 +21,6 @@ our $cgi = new CGI;
our $version = "++GIT_VERSION++";
our $my_url = $cgi->url();
our $my_uri = $cgi->url(-absolute => 1);
-our $rss_link = "";
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
@@ -97,8 +96,6 @@ if (defined $project && $project) {
if (!(-e "$projectroot/$project/HEAD")) {
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\"/>";
$ENV{'GIT_DIR'} = "$projectroot/$project";
} else {
git_project_list();
@@ -862,11 +859,13 @@ sub git_header_html {
<meta name="robots" content="index, nofollow"/>
<title>$title</title>
<link rel="stylesheet" type="text/css" href="$stylesheet"/>
-$rss_link
-</head>
-<body>
EOF
- print "<div class=\"page_header\">\n" .
+ print "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
+ "$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>\n" .
+ "</head>\n";
+
+ print "<body>\n" .
+ "<div class=\"page_header\">\n" .
"<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
"<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
"</a>\n";
--
1.4.1.1
^ permalink raw reply related
* [PATCH] Racy git: avoid having to be always too careful
From: Junio C Hamano @ 2006-08-05 11:20 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607310945490.4168@g5.osdl.org>
Immediately after a bulk checkout, most of the paths in the
working tree would have the same timestamp as the index file,
and this would force ce_match_stat() to take slow path for all
of them. When writing an index file out, if many of the paths
have very new (read: the same timestamp as the index file being
written out) timestamp, we are better off delaying the return
from the command, to make sure that later command to touch the
working tree files will leave newer timestamps than recorded in
the index, thereby avoiding to take the slow path.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Linus Torvalds <torvalds@osdl.org> writes:
> Doing an "strace" on "git diff" shows that we close() a file descriptor
> twice (getting EBADFD on the second one) when we end up in ce_compare_data
> if the index does not match the checked-out stat information.
>
> The "index_fd()" function will already have closed the fd for us, so we
> should not close it again.
>
> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> ---
>
> The way I found this also showed a potential performance problem: if you
> do a "git reset --hard" (or similar) after you have changes in your tree,
> it will write the index file with the same timestamp as the checked out
> files that it re-wrote.
>
> That will also then forever afterwards (well, until the next "git
> update-index --refresh") cause the "uncommon" timestamp case in
> ce_match_stat(), where we check the index-file timestamp against the
> timestamp of the stat data, to trigger.
>
> Not very good. The "ce_modified_check_fs()" tests can be quite expensive
> if you have lots of those files because we end up then calling the
> "ce_compare_data()" function a lot. And suddenly "git diff" doesn't take a
> tenth of a second any more.
>
> We should really try to have some way to re-generate the index
> automatically when this case triggers, so that we only need to do it
> _once_ rather than keep doing it forever while the index is "potentially
> stale".
>
> Any ideas?
Here is what I came up with. I am not very happy with its
magic, but should be better than nothing.
read-cache.c | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index f92cdaa..ce76c20 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -5,6 +5,7 @@
*/
#include "cache.h"
#include "cache-tree.h"
+#include <time.h>
/* Index extensions.
*
@@ -923,7 +924,7 @@ static void ce_smudge_racily_clean_entry
* $ echo filfre >nitfol
* $ git-update-index --add nitfol
*
- * but it does not. Whe the second update-index runs,
+ * but it does not. When the second update-index runs,
* it notices that the entry "frotz" has the same timestamp
* as index, and if we were to smudge it by resetting its
* size to zero here, then the object name recorded
@@ -945,7 +946,9 @@ int write_cache(int newfd, struct cache_
{
SHA_CTX c;
struct cache_header hdr;
- int i, removed;
+ int i, removed, recent;
+ struct stat st;
+ time_t now;
for (i = removed = 0; i < entries; i++)
if (!cache[i]->ce_mode)
@@ -959,15 +962,19 @@ int write_cache(int newfd, struct cache_
if (ce_write(&c, newfd, &hdr, sizeof(hdr)) < 0)
return -1;
+ now = fstat(newfd, &st) ? 0 : st.st_mtime;
+ recent = 0;
for (i = 0; i < entries; i++) {
struct cache_entry *ce = cache[i];
+ time_t entry_time = (time_t) ntohl(ce->ce_mtime.sec);
if (!ce->ce_mode)
continue;
- if (index_file_timestamp &&
- index_file_timestamp <= ntohl(ce->ce_mtime.sec))
+ if (index_file_timestamp && index_file_timestamp <= entry_time)
ce_smudge_racily_clean_entry(ce);
if (ce_write(&c, newfd, ce, ce_size(ce)) < 0)
return -1;
+ if (now && now <= entry_time)
+ recent++;
}
/* Write extension data here */
@@ -983,5 +990,34 @@ int write_cache(int newfd, struct cache_
return -1;
}
}
+
+ /*
+ * To prevent later ce_match_stat() from always falling into
+ * check_fs(), if we have too many entries that can trigger
+ * racily clean check, we are better off delaying the return.
+ * We arbitrarily say if more than 20 paths or 25% of total
+ * paths are very new, we delay the return until the index
+ * file gets a new timestamp.
+ *
+ * NOTE! NOTE! NOTE!
+ *
+ * This assumes that nobody is touching the working tree while
+ * we are updating the index.
+ */
+ if (20 < recent || entries <= recent * 4) {
+ now = fstat(newfd, &st) ? 0 : st.st_mtime;
+ while (now && !fstat(newfd, &st) && st.st_mtime <= now) {
+ struct timespec rq, rm;
+ off_t where = lseek(newfd, 0, SEEK_CUR);
+ rq.tv_sec = 0;
+ rq.tv_nsec = 250000000;
+ nanosleep(&rq, &rm);
+ if ((where == (off_t) -1) ||
+ (write(newfd, "", 1) != 1) ||
+ (lseek(newfd, -1, SEEK_CUR) != where) ||
+ ftruncate(newfd, where))
+ break;
+ }
+ }
return ce_flush(&c, newfd);
}
--
1.4.2.rc3.g19a8a
^ permalink raw reply related
* Re: [PATCH] git-status: colorize status output
From: Junio C Hamano @ 2006-08-05 11:21 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20060805105953.GA5410@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> writes:
> Jeff King <peff@peff.net> wrote:
>> The git-status output can sometimes be very verbose, making it difficult to
>> quickly see whether your files are updated in the index. This adds 4 levels
>> of colorizing to the status output:
>> - general header (defaults to normal white)
>> - updated but not committed (defaults to green)
>> - changed but not updated (defaults to red)
>> - untracked files (defaults to red)
>> The idea is that red things indicate a potential mistake on the part of the
>> user (e.g., forgetting to update a file, forgetting to git-add a file).
> Perhaps the default values should not use the same color twice? I'd
> suggest yellow for changed but not updated. But well, it's no problem
> to change this in my config, I just find it a bit confusing to have
> the same color for different things.
>
>> Color support is controlled by status.color and status.color.*. There is no
>> command line option, and the status.color variable is a simple boolean (no
>> checking for tty output).
> Is there any way to do isatty() from shell scripts?
Yes.
^ permalink raw reply
* [PATCH 7/9] gitweb: No error messages with unescaped/unprotected user input
From: Jakub Narebski @ 2006-08-05 11:15 UTC (permalink / raw)
To: git
In-Reply-To: <44d47813.36251c31.2553.3cf7@mx.gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Probably some error messages with unescaped user input are left...
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d8ba016..013bfe7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1265,7 +1265,7 @@ ## 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, "Unknown order parameter");
}
my @list = git_read_projects();
--
1.4.1.1
^ permalink raw reply related
* Re: [PATCH] git-status: colorize status output
From: Junio C Hamano @ 2006-08-05 11:27 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <7vejvve8ci.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
>> Is there any way to do isatty() from shell scripts?
>
> Yes.
Oops -- wrong answer which is too short.
$ git grep -B1 'standard input' -- '*.sh'
^ permalink raw reply
* Re: [PATCH] git-status: colorize status output
From: Matthias Lederhofer @ 2006-08-05 11:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7vejvve8ci.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
> >> Color support is controlled by status.color and status.color.*. There is no
> >> command line option, and the status.color variable is a simple boolean (no
> >> checking for tty output).
> > Is there any way to do isatty() from shell scripts?
>
> Yes.
How? :) Is there any reason not checking isatty()?
^ permalink raw reply
* [PATCH 6/9] gitweb: No periods for error messages
From: Jakub Narebski @ 2006-08-05 11:13 UTC (permalink / raw)
To: git
In-Reply-To: <44d47813.36251c31.2553.3cf7@mx.gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Like in Luben Tuikov patch
gitweb/gitweb.perl | 92 ++++++++++++++++++++++++++--------------------------
1 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8773a8d..d8ba016 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -76,7 +76,7 @@ # input validation and dispatch
our $action = $cgi->param('a');
if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
- die_error(undef, "Invalid action parameter.");
+ die_error(undef, "Invalid action parameter");
}
# action which does not check rest of parameters
if ($action eq "opml") {
@@ -89,13 +89,13 @@ our $project = ($cgi->param('p') || $ENV
if (defined $project) {
$project =~ s|^/||; $project =~ s|/$||;
if (!validate_input($project)) {
- die_error(undef, "Invalid project parameter.");
+ die_error(undef, "Invalid project parameter");
}
if (!(-d "$projectroot/$project")) {
- die_error(undef, "No such directory.");
+ die_error(undef, "No such directory");
}
if (!(-e "$projectroot/$project/HEAD")) {
- 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\"/>";
@@ -108,42 +108,42 @@ if (defined $project) {
our $file_name = $cgi->param('f');
if (defined $file_name) {
if (!validate_input($file_name)) {
- die_error(undef, "Invalid file parameter.");
+ die_error(undef, "Invalid file parameter");
}
}
our $hash = $cgi->param('h');
if (defined $hash) {
if (!validate_input($hash)) {
- die_error(undef, "Invalid hash parameter.");
+ die_error(undef, "Invalid hash parameter");
}
}
our $hash_parent = $cgi->param('hp');
if (defined $hash_parent) {
if (!validate_input($hash_parent)) {
- die_error(undef, "Invalid hash parent parameter.");
+ die_error(undef, "Invalid hash parent parameter");
}
}
our $hash_base = $cgi->param('hb');
if (defined $hash_base) {
if (!validate_input($hash_base)) {
- die_error(undef, "Invalid hash base parameter.");
+ die_error(undef, "Invalid hash base parameter");
}
}
our $page = $cgi->param('pg');
if (defined $page) {
if ($page =~ m/[^0-9]$/) {
- die_error(undef, "Invalid page parameter.");
+ die_error(undef, "Invalid page parameter");
}
}
our $searchtext = $cgi->param('s');
if (defined $searchtext) {
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
- die_error(undef, "Invalid search parameter.");
+ die_error(undef, "Invalid search parameter");
}
$searchtext = quotemeta $searchtext;
}
@@ -172,7 +172,7 @@ my %actions = (
$action = 'summary' if (!defined($action));
if (!defined($actions{$action})) {
- die_error(undef, "Unknown action.");
+ die_error(undef, "Unknown action");
}
$actions{$action}->();
exit;
@@ -418,7 +418,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;
@@ -1265,13 +1265,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'});
@@ -1405,7 +1405,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');
@@ -1461,10 +1461,10 @@ 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, "Couldn't find base commit.") unless ($hash_base);
+ die_error(undef, "Couldn't find base commit") unless ($hash_base);
my %co = git_read_commit($hash_base)
or die_error(undef, "Reading commit failed");
if (!defined $hash) {
@@ -1476,7 +1476,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") .
@@ -1519,18 +1519,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('404 Not Found', "File name not defined.") if (!$file_name);
+ die_error('403 Permission denied', "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, "Couldn't find base commit.") unless ($hash_base);
+ die_error(undef, "Couldn't find base commit") 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") .
@@ -1640,9 +1640,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;
@@ -1673,14 +1673,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;
@@ -1738,9 +1738,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();
@@ -1816,7 +1816,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;
@@ -1877,7 +1877,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'});
@@ -1887,9 +1887,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;
@@ -2105,15 +2105,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 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;
@@ -2191,9 +2191,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;
@@ -2251,7 +2251,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();
@@ -2309,14 +2309,14 @@ sub git_history {
sub git_search {
if (!defined $searchtext) {
- die_error(undef, "Text field empty.");
+ die_error(undef, "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 :)
@@ -2454,7 +2454,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;
@@ -2482,9 +2482,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 git-rev-list failed.");
+ close $fd or die_error(undef, "Reading git-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.1.1
^ permalink raw reply related
* [PATCH 8/9] gitweb: PATH_INFO=/ means no project
From: Jakub Narebski @ 2006-08-05 11:16 UTC (permalink / raw)
To: git
In-Reply-To: <44d47813.36251c31.2553.3cf7@mx.gmail.com>
Prepared for refactoring input validation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.perl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 013bfe7..2e1a2ba 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -86,8 +86,8 @@ if (defined $action) {
}
our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
-if (defined $project) {
- $project =~ s|^/||; $project =~ s|/$||;
+$project =~ s|^/||; $project =~ s|/$||;
+if (defined $project && $project) {
if (!validate_input($project)) {
die_error(undef, "Invalid project parameter");
}
--
1.4.1.1
^ permalink raw reply related
* [PATCH 7/5] Merge changes in "split patch 1" series
From: Jakub Narebski @ 2006-08-05 11:42 UTC (permalink / raw)
To: git
In-Reply-To: <200608050036.06490.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Strange that git-format-patch does not output merges...
gitweb/gitweb.perl | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4316bd0..bf1b10f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -67,16 +67,16 @@ our $git_version = qx($GIT --version) =~
$projects_list ||= $projectroot;
if (! -d $git_temp) {
- mkdir($git_temp, 0700) || die_error("Couldn't mkdir $git_temp");
+ mkdir($git_temp, 0700) || die_error(undef, "Couldn't mkdir $git_temp");
}
-# ======================================================================
-# input validation and dispatch
+## ======================================================================
+## input validation and dispatch
our $action = $cgi->param('a');
if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
- die_error(undef, "Invalid action parameter $action");
+ die_error(undef, "Invalid action parameter");
}
# action which does not check rest of parameters
if ($action eq "opml") {
@@ -87,15 +87,15 @@ if (defined $action) {
our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
$project =~ s|^/||; $project =~ s|/$||;
-if (defined $project || $project) {
+if (defined $project && $project) {
if (!validate_input($project)) {
- die_error(undef, "Invalid project parameter $project");
+ die_error(undef, "Invalid project parameter");
}
if (!(-d "$projectroot/$project")) {
- die_error(undef, "No such directory $project");
+ die_error(undef, "No such directory");
}
if (!(-e "$projectroot/$project/HEAD")) {
- die_error(undef, "No such project $project");
+ die_error(undef, "No such project");
}
$ENV{'GIT_DIR'} = "$projectroot/$project";
} else {
@@ -106,42 +106,42 @@ if (defined $project || $project) {
our $file_name = $cgi->param('f');
if (defined $file_name) {
if (!validate_input($file_name)) {
- die_error(undef, "Invalid file parameter $file_name");
+ die_error(undef, "Invalid file parameter");
}
}
our $hash = $cgi->param('h');
if (defined $hash) {
if (!validate_input($hash)) {
- die_error(undef, "Invalid hash parameter $hash");
+ die_error(undef, "Invalid hash parameter");
}
}
our $hash_parent = $cgi->param('hp');
if (defined $hash_parent) {
if (!validate_input($hash_parent)) {
- die_error(undef, "Invalid hash parent parameter $hash_parent");
+ die_error(undef, "Invalid hash parent parameter");
}
}
our $hash_base = $cgi->param('hb');
if (defined $hash_base) {
if (!validate_input($hash_base)) {
- die_error(undef, "Invalid hash base parameter $hash_base");
+ die_error(undef, "Invalid hash base parameter");
}
}
our $page = $cgi->param('pg');
if (defined $page) {
if ($page =~ m/[^0-9]$/) {
- die_error(undef, "Invalid page parameter $page");
+ die_error(undef, "Invalid page parameter");
}
}
our $searchtext = $cgi->param('s');
if (defined $searchtext) {
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
- die_error(undef, "Invalid search parameter $searchtext");
+ die_error(undef, "Invalid search parameter");
}
$searchtext = quotemeta $searchtext;
}
@@ -170,7 +170,7 @@ my %actions = (
$action = 'summary' if (!defined($action));
if (!defined($actions{$action})) {
- die_error(undef, "Unknown action $action");
+ die_error(undef, "Unknown action");
}
$actions{$action}->();
exit;
@@ -1282,7 +1282,7 @@ ## 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, "Unknown order parameter");
}
my @list = git_read_projects();
@@ -1479,7 +1479,7 @@ sub git_blame2 {
my $fd;
my $ftype;
die_error(undef, "Permission denied") if (!git_get_project_config_bool ('blame'));
- die_error('404 Not Found', "File name not defined.") if (!$file_name);
+ die_error('404 Not Found', "File name not defined") if (!$file_name);
$hash_base ||= git_get_head($project);
die_error(undef, "Couldn't find base commit") unless ($hash_base);
my %co = parse_commit($hash_base)
@@ -1539,12 +1539,12 @@ sub git_blame {
die_error('403 Permission denied', "Permission denied") if (!git_get_project_config_bool ('blame'));
die_error('404 Not Found', "File name not defined") if (!$file_name);
$hash_base ||= git_get_head($project);
- die_error(undef, "Couldn't find base commit.") unless ($hash_base);
+ die_error(undef, "Couldn't find base commit") unless ($hash_base);
my %co = parse_commit($hash_base)
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 $file_name");
+ 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");
@@ -1656,14 +1656,14 @@ sub git_blob_plain {
if (defined $file_name) {
my $base = $hash_base || git_get_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file $file_name");
+ or die_error(undef, "Error lookup file");
} else {
die_error(undef, "No file name defined");
}
}
my $type = shift;
open my $fd, "-|", $GIT, "cat-file", "blob", $hash
- or die_error("Couldn't cat $file_name, $hash");
+ or die_error(undef, "Couldn't cat $file_name, $hash");
$type ||= blob_plain_mimetype($fd, $file_name);
@@ -1689,7 +1689,7 @@ sub git_blob {
if (defined $file_name) {
my $base = $hash_base || git_get_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file $file_name");
+ or die_error(undef, "Error lookup file");
} else {
die_error(undef, "No file name defined");
}
--
1.4.1.1
git diff --patch-with-stat
^ permalink raw reply related
* Re: [PATCH] git-status: colorize status output
From: Junio C Hamano @ 2006-08-05 11:42 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git, Jeff King
In-Reply-To: <20060805112851.GA20807@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> writes:
> Junio C Hamano <junkio@cox.net> wrote:
>> Matthias Lederhofer <matled@gmx.net> writes:
>> >> Color support is controlled by status.color and status.color.*. There is no
>> >> command line option, and the status.color variable is a simple boolean (no
>> >> checking for tty output).
>> > Is there any way to do isatty() from shell scripts?
>>
>> Yes.
> How? :)
Arrrrrrrgh! The message I wanted to send you went to Jeff.
Your Mail-Followup-To: fooled me. Please do not do this.
$ git grep -B1 'standard input' -- '*.sh'
git-commit.sh- test -t 0 &&
git-commit.sh: echo >&2 "(reading log message from standard input)"
> Is there any reason not checking isatty()?
Not that I can think of, but do people really run "git status"?
I think Jeff's follow-up "vim colorizer" makes a lot more sense
than colorizing "git status" output -- it gives reminder during
the last chance the user has to notice such problems, which is
while composing the commit log message.
^ permalink raw reply
* Re: [PATCH] git-status: colorize status output
From: Matthias Lederhofer @ 2006-08-05 12:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v64h7e7dm.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
> Arrrrrrrgh! The message I wanted to send you went to Jeff.
>
> Your Mail-Followup-To: fooled me. Please do not do this.
Sorry.
> > Is there any reason not checking isatty()?
>
> Not that I can think of, but do people really run "git status"?
I do :)
> I think Jeff's follow-up "vim colorizer" makes a lot more sense
> than colorizing "git status" output -- it gives reminder during
> the last chance the user has to notice such problems, which is
> while composing the commit log message.
I like the colored git status. Here is a patch to honor isatty(1) and
pager_in_use (exporting GIT_PAGER_IN_USE) with pager.color.
---
From c01b26cd332283d3b3feaeae4a8218bb409aea2c Mon Sep 17 00:00:00 2001
From: Matthias Lederhofer <matled@gmx.net>
Date: Sat, 5 Aug 2006 14:09:49 +0200
Subject: [PATCH] git-status: do not use colors all the time
Either [ -t 1 ] has to be true or the pager is used and pager.color is
not false.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
git-commit.sh | 6 +++++-
| 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index b7269c2..ad0cbb1 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -20,7 +20,11 @@ case "$0" in
*status)
status_only=t
unmerged_ok_if_status=--unmerged
- color=`git-repo-config --bool --get status.color`
+ [ "`git-repo-config --bool --get status.color`" = 'true' ] &&
+ ([ -t 1 ] || (
+ [ -n "$GIT_PAGER_IN_USE" ] &&
+ [ "`git-repo-config --bool --get pager.color`" != 'false' ]
+ )) && color=true
eval `git-repo-config --get-regexp status.color. \
| while read k v; do
echo color_${k#status.color.}=$v
--git a/pager.c b/pager.c
index dcb398d..3ba4166 100644
--- a/pager.c
+++ b/pager.c
@@ -27,6 +27,7 @@ void setup_pager(void)
return;
pager_in_use = 1; /* means we are emitting to terminal */
+ setenv("GIT_PAGER_IN_USE", "1", 1);
if (pipe(fd) < 0)
return;
--
1.4.2.rc2.gd71a
^ permalink raw reply related
* Re: [PATCH 7/5] Merge changes in "split patch 1" series
From: Johannes Schindelin @ 2006-08-05 14:55 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <eb2068$cm7$1@sea.gmane.org>
Hi,
On Sat, 5 Aug 2006, Jakub Narebski wrote:
> Strange that git-format-patch does not output merges...
And what exactly should it output? patch against commit^1 or commit^2,
etc.? Both? Combined diff?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 7/5] Merge changes in "split patch 1" series
From: Jakub Narebski @ 2006-08-05 15:05 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.63.0608051654390.1800@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
> On Sat, 5 Aug 2006, Jakub Narebski wrote:
>
>> Strange that git-format-patch does not output merges...
>
> And what exactly should it output? patch against commit^1 or commit^2,
> etc.? Both? Combined diff?
In my case, commit^1. But I'd be satisfied if it would warn me about missing
commit (the merge was topmost commit).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH 6/9] gitweb: No periods for error messages
From: Luben Tuikov @ 2006-08-05 15:55 UTC (permalink / raw)
To: Jakub Narebski, git
In-Reply-To: <eb1ug6$8ti$2@sea.gmane.org>
--- Jakub Narebski <jnareb@gmail.com> wrote:
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> Like in Luben Tuikov patch
Good work!
I see this patch bears identical Subject line and
is logically identical as the one I posted.
Maybe you ment to include the above line above your
Signed-off-by: line?
Luben
>
> gitweb/gitweb.perl | 92 ++++++++++++++++++++++++++--------------------------
> 1 files changed, 46 insertions(+), 46 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 8773a8d..d8ba016 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -76,7 +76,7 @@ # input validation and dispatch
> our $action = $cgi->param('a');
> if (defined $action) {
> if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
> - die_error(undef, "Invalid action parameter.");
> + die_error(undef, "Invalid action parameter");
> }
> # action which does not check rest of parameters
> if ($action eq "opml") {
> @@ -89,13 +89,13 @@ our $project = ($cgi->param('p') || $ENV
> if (defined $project) {
> $project =~ s|^/||; $project =~ s|/$||;
> if (!validate_input($project)) {
> - die_error(undef, "Invalid project parameter.");
> + die_error(undef, "Invalid project parameter");
> }
> if (!(-d "$projectroot/$project")) {
> - die_error(undef, "No such directory.");
> + die_error(undef, "No such directory");
> }
> if (!(-e "$projectroot/$project/HEAD")) {
> - 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\"/>";
> @@ -108,42 +108,42 @@ if (defined $project) {
> our $file_name = $cgi->param('f');
> if (defined $file_name) {
> if (!validate_input($file_name)) {
> - die_error(undef, "Invalid file parameter.");
> + die_error(undef, "Invalid file parameter");
> }
> }
>
> our $hash = $cgi->param('h');
> if (defined $hash) {
> if (!validate_input($hash)) {
> - die_error(undef, "Invalid hash parameter.");
> + die_error(undef, "Invalid hash parameter");
> }
> }
>
> our $hash_parent = $cgi->param('hp');
> if (defined $hash_parent) {
> if (!validate_input($hash_parent)) {
> - die_error(undef, "Invalid hash parent parameter.");
> + die_error(undef, "Invalid hash parent parameter");
> }
> }
>
> our $hash_base = $cgi->param('hb');
> if (defined $hash_base) {
> if (!validate_input($hash_base)) {
> - die_error(undef, "Invalid hash base parameter.");
> + die_error(undef, "Invalid hash base parameter");
> }
> }
>
> our $page = $cgi->param('pg');
> if (defined $page) {
> if ($page =~ m/[^0-9]$/) {
> - die_error(undef, "Invalid page parameter.");
> + die_error(undef, "Invalid page parameter");
> }
> }
>
> our $searchtext = $cgi->param('s');
> if (defined $searchtext) {
> if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
> - die_error(undef, "Invalid search parameter.");
> + die_error(undef, "Invalid search parameter");
> }
> $searchtext = quotemeta $searchtext;
> }
> @@ -172,7 +172,7 @@ my %actions = (
>
> $action = 'summary' if (!defined($action));
> if (!defined($actions{$action})) {
> - die_error(undef, "Unknown action.");
> + die_error(undef, "Unknown action");
> }
> $actions{$action}->();
> exit;
> @@ -418,7 +418,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;
>
> @@ -1265,13 +1265,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'});
> @@ -1405,7 +1405,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');
> @@ -1461,10 +1461,10 @@ 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, "Couldn't find base commit.") unless ($hash_base);
> + die_error(undef, "Couldn't find base commit") unless ($hash_base);
> my %co = git_read_commit($hash_base)
> or die_error(undef, "Reading commit failed");
> if (!defined $hash) {
> @@ -1476,7 +1476,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") .
> @@ -1519,18 +1519,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('404 Not Found', "File name not defined.") if (!$file_name);
> + die_error('403 Permission denied', "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, "Couldn't find base commit.") unless ($hash_base);
> + die_error(undef, "Couldn't find base commit") 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") .
> @@ -1640,9 +1640,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;
> @@ -1673,14 +1673,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;
> @@ -1738,9 +1738,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();
> @@ -1816,7 +1816,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;
>
> @@ -1877,7 +1877,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'});
> @@ -1887,9 +1887,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;
> @@ -2105,15 +2105,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 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;
> @@ -2191,9 +2191,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;
> @@ -2251,7 +2251,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();
> @@ -2309,14 +2309,14 @@ sub git_history {
>
> sub git_search {
> if (!defined $searchtext) {
> - die_error(undef, "Text field empty.");
> + die_error(undef, "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 :)
> @@ -2454,7 +2454,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;
>
> @@ -2482,9 +2482,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 git-rev-list failed.");
> + close $fd or die_error(undef, "Reading git-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.1.1
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH 6/9] gitweb: No periods for error messages
From: Jakub Narebski @ 2006-08-05 16:15 UTC (permalink / raw)
To: git
In-Reply-To: <20060805155504.6832.qmail@web31807.mail.mud.yahoo.com>
Luben Tuikov wrote:
> --- Jakub Narebski <jnareb@gmail.com> wrote:
>
>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
>> ---
>> Like in Luben Tuikov patch
>
> Good work!
>
> I see this patch bears identical Subject line and
> is logically identical as the one I posted.
>
> Maybe you ment to include the above line above your
> Signed-off-by: line?
Probably should have just added you to Signed-off-by: line.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Git files data formats documentation
From: Shawn Pearce @ 2006-08-05 16:22 UTC (permalink / raw)
To: A Large Angry SCM; +Cc: git
In-Reply-To: <44D42F0D.3040707@gmail.com>
A Large Angry SCM <gitzilla@gmail.com> wrote:
> This information may be useful for reading and writing the various Git
> files.
[snip]
> # /* - - - - - - - - - - - - *\
> # | This reflects version 3 pack files |
> # \* - - - - - - - - - - - - */
[snip]
> # /* - - - - - - - - - - - - *\
> # | This reflects version 2 pack files |
> # \* - - - - - - - - - - - - */
Thanks for taking the time to write these out. The pack delta
formats were particularly helpful as it caused me to go back
and look at the unpacking code in jgit.
Apparently I wasn't handling the version 2 pack file correctly as I
didn't support copy-from-result; I had an infinite loop if the base
didn't decompress in one read (never happen right now, but could
in the future); and apparently my insert opcode implementation was
causing an infinite loop. Nasty bugs. I need to get more unit
tests written apparently. :-)
--
Shawn.
^ permalink raw reply
* RE: [PATCH 6/10] Fix header breakage with _XOPEN_SOURCE.
From: Ramsay Jones @ 2006-08-05 17:11 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0608040211160.1800@wbgn013.biozentrum.uni-wuerzburg.de>
On Fri, 2006-08-04 at 1:20, Johannes Schindelin wrote:
> Hi,
>
> On Wed, 2 Aug 2006, Ramsay Jones wrote:
>
> > [...] but strptime() remains undeclared.
>
> Note that there is just one call to strptime() in the C sources:
> convert-objects.
>
> Also, we have something more portable in git now: you might be able to
> substitute
>
> const char *next = strptime(buf, *fmt, &tm);
> if (next) {
>
> by something like
>
> char buffer[50];
> int len = parse_date(buf, buffer, sizeof(buffer));
> const char *next = buf + len;
>
> if (len) {
> const char *tzstring = strchr(buffer, ' ') + 1;
> int tz = (int)strtol(tzstring, NULL, 10);
> tm = *time_to_tm(strtoul(buffer, NULL, 10), tz);
>
> However, I did not test it, and this might be completely bogus.
>
Yes, I'm sure something like that could be done, but I really don't
think we need anything that intrusive to fix such a simple problem.
Indeed, I would rather Junio ignore the patch if it appears to cause
anyone else a problem. I can maintain it locally (it's only one line!).
After all, I'm pretty sure I'm the only idiot^H^H^H^H^H person using a
six year old dev system.
Ramsay
^ permalink raw reply
* Re: Git files data formats documentation
From: A Large Angry SCM @ 2006-08-05 17:31 UTC (permalink / raw)
To: Shawn Pearce, git
In-Reply-To: <20060805162233.GA19909@spearce.org>
Shawn Pearce wrote:
> A Large Angry SCM <gitzilla@gmail.com> wrote:
>> This information may be useful for reading and writing the various Git
>> files.
> [snip]
>> # /* - - - - - - - - - - - - *\
>> # | This reflects version 3 pack files |
>> # \* - - - - - - - - - - - - */
> [snip]
>> # /* - - - - - - - - - - - - *\
>> # | This reflects version 2 pack files |
>> # \* - - - - - - - - - - - - */
>
> Thanks for taking the time to write these out. The pack delta
> formats were particularly helpful as it caused me to go back
> and look at the unpacking code in jgit.
>
> Apparently I wasn't handling the version 2 pack file correctly as I
> didn't support copy-from-result; I had an infinite loop if the base
> didn't decompress in one read (never happen right now, but could
> in the future); and apparently my insert opcode implementation was
> causing an infinite loop. Nasty bugs. I need to get more unit
> tests written apparently. :-)
Keep in mind that the git-core code for reading version 2 or version 3
pack files does _not_ handle copy-from-result correctly.
^ permalink raw reply
* Your cash, olive nut
From: Maryann Godfrey @ 2006-08-05 14:57 UTC (permalink / raw)
To: git-commits-head-owner
Even if you have no erectin problems SOFT CIA7LIS
would help you to make BETTER SEMX MORE OFTEN!
and to bring unimagnable plesure to her.
Just disolve half a pil under your tongue
and get ready for action in 15 minutes.
The tests showed that the majority of men
after taking this medic ation were able to have
PERFECT ERTECTION during 36 hours!
VISIT US, AND GET OUR SPECIAL 70% DISCWOUNT OFER!
http://lsfajf.mustguest.com/?83963344
==========
horizons out ahead for us all. He stepped forward.
the whole thing-just emptiness and more emptiness, thin air. And for all
speak, the shots came is the Pilman Radiant."
unscrewed the cap, and attached myself to it like a lamprey. I sat on the
Without warning, Chiang vanished and appeared at the water's edge
"What web? Where?"
His vows of a moment before were forgotten, swept away in that great
technology that we command," he blathered, "al- most completely guarantees
^ permalink raw reply
* Re: Git files data formats documentation
From: Jakub Narebski @ 2006-08-05 18:41 UTC (permalink / raw)
To: git
In-Reply-To: <44D42F0D.3040707@gmail.com>
A Large Angry SCM wrote:
> <TREE_ENTRY>
> # The type of the object referenced MUST be appropriate for
> # the mode. Regular files and symbolic links reference a BLOB
> # and directories reference a TREE.
> : <OCTAL_MODE> <SP> <NAME> <NUL> <BINARY_OBJ_ID>
> ;
[...]
> <OCTAL_MODE>
> # Octal encoding, without prefix, of the file system object
> # type and permission bits. The bit layout is according to the
> # POSIX standard, with only regular files, directories, and
> # symbolic links permitted. The actual permission bits are
> # all zero except for regular files. The only permission bit
> # of any consequence to Git is the owner executable bit. By
> # default, the permission bits for files will be either 0644
> # or 0755, depending on the owner executable bit.
> ;
I do wonder why there is <OCTAL_MODE> (and not <BINARY_OCTAL_MODE>)
but <BINARY_OBJ_ID> (and not <HEX_OBJ_ID>).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFC/PATCH] Fix "grep -w"
From: Morten Welinder @ 2006-08-05 19:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vwt9ng3t1.fsf@assigned-by-dhcp.cox.net>
1. Are you sure that going to the end of the first match is correct?
It seems to
me that this will skip matches. Say you search for ".*" on a line that reads
" xxx".
2. What about "^"?
3. What about empty matches? That could take a while...
Morten
^ permalink raw reply
* Re: Git files data formats documentation
From: Shawn Pearce @ 2006-08-05 19:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: A Large Angry SCM, git
In-Reply-To: <7vac6jfzem.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Not quite. An entry for a subtree is sorted as if a '/' is
> suffixed to its name.
>
> $ git ls-tree $T
> 100644 blob 2398e9f8892812607f5eee6ed0d5712c2e3de197 a-
> 100644 blob 7f07527a80bd8c2b1c5087d7ccfe61073b068374 a-b
> 040000 tree 23fddf6a57ff3ba98aa93fb71431276c3f1a3c40 a
> 100644 blob 2afe6dcc5466068b8dcc7263cece05d2adf044fe a=
> 100644 blob efc73add7dd868242a66faf2a59b145f2a60b834 a=b
>
> This is, by the way, consistent with the order of cache entries
> in the index file.
Arrrrgh. I didn't realize that '/' was needed on the end of a tree
name when sorting its parent for output. jgit was/is definately
doing this wrong. And it all comes back to how the index operates,
doesn't it? :-)
I've got to go back now and do some surgery on how jgit sorts
entries in a tree. Clearly it would be incorrect with the example
you just gave. It also would have thought that core GIT generated
a corrupt tree if it tried to read in your example. Thank you for
taking the time to clarify it!
--
Shawn.
^ permalink raw reply
* Re: [PATCH] git-status: colorize status output
From: Jeff King @ 2006-08-05 19:45 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: Junio C Hamano, git
In-Reply-To: <20060805105953.GA5410@moooo.ath.cx>
On Sat, Aug 05, 2006 at 12:59:53PM +0200, Matthias Lederhofer wrote:
> Perhaps the default values should not use the same color twice? I'd
> suggest yellow for changed but not updated. But well, it's no problem
> to change this in my config, I just find it a bit confusing to have
> the same color for different things.
I'm fine with changing the defaults as you suggest. It makes more sense
to me with only two colors (files is a potential mistake or not), but I
added more fine-grained support because it was trivial and I thought
others might want to customize it.
We could, of course, allow even more fine-grained control by matching
file type (added, deleted, modified, etc), but I'm not sure anybody
would want that.
> Is there any way to do isatty() from shell scripts?
As Junio said, test -t. :) Is there interest in me adding that feature?
-Peff
^ permalink raw reply
* Re: [PATCH] git-status: colorize status output
From: Jeff King @ 2006-08-05 19:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Matthias Lederhofer, git
In-Reply-To: <7v64h7e7dm.fsf@assigned-by-dhcp.cox.net>
On Sat, Aug 05, 2006 at 04:42:29AM -0700, Junio C Hamano wrote:
> Not that I can think of, but do people really run "git status"?
I do! :) I actually wrote the vim colorizer first and used it for a
week before realizing it was not sufficient, and that I wanted
git-status output colorized, too. So please consider including the
patch.
> I think Jeff's follow-up "vim colorizer" makes a lot more sense
> than colorizing "git status" output -- it gives reminder during
> the last chance the user has to notice such problems, which is
> while composing the commit log message.
It looks like we have some similar emacs stuff in contrib/. Should I
prepare a short patch to create contrib/vim/?
-Peff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox