* Re: Odd behavior with git and cairo-devel repo
From: Junio C Hamano @ 2006-06-21 11:01 UTC (permalink / raw)
To: Andre Noll; +Cc: git, Art Haas
In-Reply-To: <20060621024605.GO11245@skl-net.de>
Andre Noll <maan@systemlinux.org> writes:
> On 20:00, Art Haas wrote:
>
>> $ git clone git://git.cairographics.org/git/cairo cairo
>> [ ... git clones the repo without problem ... ]
>> $ cd cairo
>> $ git fsck-objects
>> Floating point exception
>
> This is due to refs_hash_size being zero in mark_reachable().
> Both "git fsck-objects --full" and "git repack -a -d" seem to work
> fine with the patch below (tested by cloning your repo).
Good catch. Thanks both!
^ permalink raw reply
* [PATCH 4/4] upload-pack/fetch-pack: support side-band communication
From: Junio C Hamano @ 2006-06-21 11:01 UTC (permalink / raw)
To: git
This implements a protocol extension between fetch-pack and
upload-pack to allow stderr stream from upload-pack (primarily
used for the progress bar display) to be passed back.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* With this, fetching and cloning over git+ssh:// and git://
does not discard the progress bar and error messages that
upload-pack emits on its standard output. They are sent to
the downloader and shown to the user.
Somehow this does not work when connecting to git daemon that
runs under inetd. Fixes appreciated.
cache.h | 4 ++-
fetch-clone.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
fetch-pack.c | 22 +++++++++++++-----
pkt-line.c | 4 ++-
pkt-line.h | 1 +
upload-pack.c | 60 +++++++++++++++++++++++++++++++++++++++++-------
6 files changed, 139 insertions(+), 23 deletions(-)
diff --git a/cache.h b/cache.h
index eaa5c0c..efeafea 100644
--- a/cache.h
+++ b/cache.h
@@ -374,8 +374,8 @@ extern char git_commit_encoding[MAX_ENCO
extern int copy_fd(int ifd, int ofd);
/* Finish off pack transfer receiving end */
-extern int receive_unpack_pack(int fd[2], const char *me, int quiet);
-extern int receive_keep_pack(int fd[2], const char *me, int quiet);
+extern int receive_unpack_pack(int fd[2], const char *me, int quiet, int);
+extern int receive_keep_pack(int fd[2], const char *me, int quiet, int);
/* pager.c */
extern void setup_pager(void);
diff --git a/fetch-clone.c b/fetch-clone.c
index da1b3ff..c16b0c4 100644
--- a/fetch-clone.c
+++ b/fetch-clone.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "exec_cmd.h"
+#include "pkt-line.h"
#include <sys/wait.h>
#include <sys/time.h>
@@ -23,7 +24,7 @@ static int finish_pack(const char *pack_
pid = fork();
if (pid < 0)
- die("git-clone-pack: unable to fork off git-index-pack");
+ die("%s: unable to fork off git-index-pack", me);
if (!pid) {
close(0);
dup2(pipe_fd[1], 1);
@@ -94,11 +95,69 @@ static int finish_pack(const char *pack_
exit(1);
}
-int receive_unpack_pack(int fd[2], const char *me, int quiet)
+static pid_t setup_sideband(int sideband, const char *me, int fd[2], int xd[2])
+{
+ pid_t side_pid;
+
+ if (!sideband) {
+ fd[0] = xd[0];
+ fd[1] = xd[1];
+ return 0;
+ }
+ /* xd[] is talking with upload-pack; subprocess reads from
+ * xd[0], spits out band#2 to stderr, and feeds us band#1
+ * through our fd[0].
+ */
+ if (pipe(fd) < 0)
+ die("%s: unable to set up pipe", me);
+ side_pid = fork();
+ if (side_pid < 0)
+ die("%s: unable to fork off sideband demultiplexer", me);
+ if (!side_pid) {
+ /* subprocess */
+ close(fd[0]);
+ if (xd[0] != xd[1])
+ close(xd[1]);
+ while (1) {
+ char buf[1024];
+ int len = packet_read_line(xd[0], buf, sizeof(buf));
+ if (len == 0)
+ break;
+ if (len < 1)
+ die("%s: protocol error: no band designator",
+ me);
+ len--;
+ switch (buf[0] & 0xFF) {
+ case 3:
+ safe_write(2, buf+1, len);
+ fprintf(stderr, "\n");
+ exit(1);
+ case 2:
+ safe_write(2, buf+1, len);
+ continue;
+ case 1:
+ safe_write(fd[1], buf+1, len);
+ continue;
+ default:
+ die("%s: protocol error: bad band #%d",
+ me, (buf[0] & 0xFF));
+ }
+ }
+ exit(0);
+ }
+ close(xd[0]);
+ close(fd[1]);
+ fd[1] = xd[1];
+ return side_pid;
+}
+
+int receive_unpack_pack(int xd[2], const char *me, int quiet, int sideband)
{
int status;
- pid_t pid;
+ pid_t pid, side_pid;
+ int fd[2];
+ side_pid = setup_sideband(sideband, me, fd, xd);
pid = fork();
if (pid < 0)
die("%s: unable to fork off git-unpack-objects", me);
@@ -147,10 +206,10 @@ #define NR_AVERAGE (4)
*/
#define usec_to_binarymsec(x) ((int)(x) / (1000512 >> 10))
-int receive_keep_pack(int fd[2], const char *me, int quiet)
+int receive_keep_pack(int xd[2], const char *me, int quiet, int sideband)
{
char tmpfile[PATH_MAX];
- int ofd, ifd;
+ int ofd, ifd, fd[2];
unsigned long total;
static struct timeval prev_tv;
struct average {
@@ -160,6 +219,8 @@ int receive_keep_pack(int fd[2], const c
unsigned long avg_bytes, avg_time;
int idx = 0;
+ setup_sideband(sideband, me, fd, xd);
+
ifd = fd[0];
snprintf(tmpfile, sizeof(tmpfile),
"%s/pack/tmp-XXXXXX", get_object_directory());
diff --git a/fetch-pack.c b/fetch-pack.c
index 7d23a80..f2c51eb 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -25,7 +25,7 @@ #define POPPED (1U << 4)
#define MAX_IN_VAIN 256
static struct commit_list *rev_list = NULL;
-static int non_common_revs = 0, multi_ack = 0, use_thin_pack = 0;
+static int non_common_revs = 0, multi_ack = 0, use_thin_pack = 0, use_sideband;
static void rev_list_push(struct commit *commit, int mark)
{
@@ -165,9 +165,14 @@ static int find_common(int fd[2], unsign
continue;
}
- packet_write(fd[1], "want %s%s%s\n", sha1_to_hex(remote),
- (multi_ack ? " multi_ack" : ""),
- (use_thin_pack ? " thin-pack" : ""));
+ if (!fetching)
+ packet_write(fd[1], "want %s%s%s%s\n",
+ sha1_to_hex(remote),
+ (multi_ack ? " multi_ack" : ""),
+ (use_sideband ? " side-band" : ""),
+ (use_thin_pack ? " thin-pack" : ""));
+ else
+ packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
fetching++;
}
packet_flush(fd[1]);
@@ -421,6 +426,11 @@ static int fetch_pack(int fd[2], int nr_
fprintf(stderr, "Server supports multi_ack\n");
multi_ack = 1;
}
+ if (server_supports("side-band")) {
+ if (verbose)
+ fprintf(stderr, "Server supports side-band\n");
+ use_sideband = 1;
+ }
if (!ref) {
packet_flush(fd[1]);
die("no matching remote head");
@@ -437,9 +447,9 @@ static int fetch_pack(int fd[2], int nr_
fprintf(stderr, "warning: no common commits\n");
if (keep_pack)
- status = receive_keep_pack(fd, "git-fetch-pack", quiet);
+ status = receive_keep_pack(fd, "git-fetch-pack", quiet, use_sideband);
else
- status = receive_unpack_pack(fd, "git-fetch-pack", quiet);
+ status = receive_unpack_pack(fd, "git-fetch-pack", quiet, use_sideband);
if (status)
die("git-fetch-pack: fetch failed.");
diff --git a/pkt-line.c b/pkt-line.c
index bb3bab0..3d724ac 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -16,8 +16,9 @@ #include "pkt-line.h"
* The writing side could use stdio, but since the reading
* side can't, we stay with pure read/write interfaces.
*/
-static void safe_write(int fd, const void *buf, unsigned n)
+ssize_t safe_write(int fd, const void *buf, ssize_t n)
{
+ ssize_t nn = n;
while (n) {
int ret = xwrite(fd, buf, n);
if (ret > 0) {
@@ -29,6 +30,7 @@ static void safe_write(int fd, const voi
die("write error (disk full?)");
die("write error (%s)", strerror(errno));
}
+ return nn;
}
/*
diff --git a/pkt-line.h b/pkt-line.h
index 51d0cbe..9abef24 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -8,5 +8,6 @@ void packet_flush(int fd);
void packet_write(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
int packet_read_line(int fd, char *buffer, unsigned size);
+ssize_t safe_write(int, const void *, ssize_t);
#endif
diff --git a/upload-pack.c b/upload-pack.c
index 13eaa22..7b86f69 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -21,6 +21,7 @@ static int use_thin_pack = 0;
static unsigned char has_sha1[MAX_HAS][20];
static unsigned char needs_sha1[MAX_NEEDS][20];
static unsigned int timeout = 0;
+static int use_sideband = 0;
static void reset_timeout(void)
{
@@ -34,6 +35,43 @@ static int strip(char *line, int len)
return len;
}
+#define PACKET_MAX 1000
+static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
+{
+ ssize_t ssz;
+ const char *p;
+
+ if (!data) {
+ if (!use_sideband)
+ return 0;
+ packet_flush(1);
+ }
+
+ if (!use_sideband) {
+ if (fd == 3)
+ /* emergency quit */
+ fd = 2;
+ return safe_write(fd, data, sz);
+ }
+ p = data;
+ ssz = sz;
+ while (sz) {
+ unsigned n;
+ char hdr[5];
+
+ n = sz;
+ if (PACKET_MAX - 5 < n)
+ n = PACKET_MAX - 5;
+ sprintf(hdr, "%04x", n + 5);
+ hdr[4] = fd;
+ safe_write(1, hdr, 5);
+ safe_write(1, p, n);
+ p += n;
+ sz -= n;
+ }
+ return ssz;
+}
+
static void create_pack_file(void)
{
/* Pipes between rev-list to pack-objects, pack-objects to us
@@ -43,6 +81,8 @@ static void create_pack_file(void)
pid_t pid_rev_list, pid_pack_objects;
int create_full_pack = (nr_our_refs == nr_needs && !nr_has);
char data[8193], progress[128];
+ char abort_msg[] = "aborting due to possible repository "
+ "corruption on the remote side.";
int buffered = -1;
if (pipe(lp_pipe) < 0)
@@ -132,7 +172,6 @@ static void create_pack_file(void)
while (1) {
const char *who;
- char *cp;
struct pollfd pfd[2];
pid_t pid;
int status;
@@ -199,19 +238,18 @@ static void create_pack_file(void)
}
else
buffered = -1;
- sz = xwrite(1, data, sz);
+ sz = send_client_data(1, data, sz);
if (sz < 0)
goto fail;
}
if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {
- /* Status ready; we do not use it for now,
- * but later we will add side-band to send it
- * to the other side.
+ /* Status ready; we ship that in the side-band
+ * or dump to the standard error.
*/
sz = read(pe_pipe[0], progress,
sizeof(progress));
if (0 < sz)
- write(2, progress, sz);
+ send_client_data(2, progress, sz);
else if (sz == 0) {
close(pe_pipe[0]);
pe_pipe[0] = -1;
@@ -259,11 +297,12 @@ static void create_pack_file(void)
/* flush the data */
if (0 <= buffered) {
data[0] = buffered;
- sz = xwrite(1, data, 1);
+ sz = send_client_data(1, data, 1);
if (sz < 0)
goto fail;
fprintf(stderr, "flushed.\n");
}
+ send_client_data(1, NULL, 0);
return;
}
fail:
@@ -271,7 +310,8 @@ static void create_pack_file(void)
kill(pid_pack_objects, SIGKILL);
if (pid_rev_list)
kill(pid_rev_list, SIGKILL);
- die("git-upload-pack: aborting due to possible repository corruption on the remote side.");
+ send_client_data(3, abort_msg, sizeof(abort_msg));
+ die("git-upload-pack: %s", abort_msg);
}
static int got_sha1(char *hex, unsigned char *sha1)
@@ -378,6 +418,8 @@ static int receive_needs(void)
multi_ack = 1;
if (strstr(line+45, "thin-pack"))
use_thin_pack = 1;
+ if (strstr(line+45, "side-band"))
+ use_sideband = 1;
/* We have sent all our refs already, and the other end
* should have chosen out of them; otherwise they are
@@ -399,7 +441,7 @@ static int receive_needs(void)
static int send_ref(const char *refname, const unsigned char *sha1)
{
- static char *capabilities = "multi_ack thin-pack";
+ static char *capabilities = "multi_ack thin-pack side-band";
struct object *o = parse_object(sha1);
if (!o)
--
1.4.0.g160a
^ permalink raw reply related
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Junio C Hamano @ 2006-06-21 11:15 UTC (permalink / raw)
To: git
In-Reply-To: <7vr71kcien.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> I think applying the patch in question on top of Florian's 11172e
> would be the most sensible, since that is currently the tip of ff/c99
> topic branch whose early parts have been merged to "next" and
> the tip to "pu". When Linus feels as sympathetic as I do, we
> can pull the rest of ff/c99 branch to "next" and then eventually
> to "master" and the patch will be merged together without
> introducing the nonsense casts.
Now, without asking Linus about this further, I felt sympathetic
enough to decide that void-pointer arithmetic avoidance is not
so bad (touches only 70 lines or so in 19 files); tonight's
"next" should be compilable with the default Solaris compiler.
^ permalink raw reply
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale
From: Jakub Narebski @ 2006-06-21 11:18 UTC (permalink / raw)
To: git
In-Reply-To: <20060621104941.GB15748@localdomain>
Eric Wong wrote:
> Jakub Narebski <jnareb@gmail.com> wrote:
>>
>>> $ENV{LC_ALL} = 'C'; does not change locale used by strftime.
>>> Use setlocale( &LC_ALL, 'C' ); instead.
> I'm responsible for the $ENV{LC_ALL} = 'C' setting but I never actually
> tested how things would work with a non-English locale (not being
> well-versed in these things myself, either).
It looks like I have broken locale badly somewhat, as I yesterday
sent patches successfully without the patch. I suspect that sendmail
removes incorrect Date: header and adds it's own... unless Date:
header contains characters outside US-ASCII.
It means that sendmail can deal with
Date: wto, 20 cze 2006 13:14:11 +0200
instead of correct
Date: Tue, 20 Jun 2006 13:14:11 +0200
but cannot deal with (iso-8859-2 encoded I think)
Date: ¶ro, 21 cze 2006 09:48:02 +0200
from git-send-email.perl without patch, instead of correct
Date: Wed, 21 Jun 2006 11:25:52 +0200
with the patch.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Odd behavior with git and cairo-devel repo
From: Art Haas @ 2006-06-21 12:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <20060621024605.GO11245@skl-net.de>
On Wed, Jun 21, 2006 at 04:46:05AM +0200, Andre Noll wrote:
> On 20:00, Art Haas wrote:
>
> > $ git clone git://git.cairographics.org/git/cairo cairo
> > [ ... git clones the repo without problem ... ]
> > $ cd cairo
> > $ git fsck-objects
> > Floating point exception
>
> This is due to refs_hash_size being zero in mark_reachable().
> Both "git fsck-objects --full" and "git repack -a -d" seem to work
> fine with the patch below (tested by cloning your repo).
>
> [ ... snip ... ]
Hi.
I see this patch has made it into git now, and it fixes the problem
described above. Thanks!
However, I'm still seeing the problem where 'git prune' leaves the
repo in an invalid state. In the case above, running 'git prune' on a
freshly checked-out repo works without problems; when the repo has a
number of unpacked objects, however, things go bad. On the FC4 machine
I have, I updated my git repo, rebuilt, and installed the build with
the patch above, then updated my cairo repo. The 'git pull' retrieved
a handful of objects, and 'git fsck-objects' ran without problem.
Then 'git prune' was run, seemingly without problem, and when I tried
'git repack -a -d' things went boom. A subsequent 'git fsck-object'
run indicated the repo was missing tree and commit objects.
Is anyone else seeing a similar problem with 'git prune'?
Art Haas
--
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.
-Thomas Jefferson to James Smith, 1822
^ permalink raw reply
* gitk lower pane (commit and files view) scrollbar extends past gitk window
From: Jakub Narebski @ 2006-06-21 12:42 UTC (permalink / raw)
To: git
In gitk from the current 'next' branch, post git version 1.4.0
(blob ba4644f) scrollbar for lower pane, i.e. for commitdiff and files
(Comments) views extends past the bottom of the gitk window. Therefore
I cannnot see lower part of commit diff if it is larger than window height.
gitk window has height lower than 700.
The upper pane, i.e. history graph scrollbar is correct, and works as it
should.
This is regression from git 1.3.0, where gitk works correctly.
Below ascii art trying to describe situation.
_ _ _
^ .. upper scrollbar arrow .... ^ ^
# # |
# .... position indicator ..... # |
| | |
| | scrolling past window edge -> #
| bottom of gitk window --> = =
v <-- no lower scrollbar arrow
= <-- bottom of gitk window
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Dennis Stosberg @ 2006-06-21 13:05 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Jakub Narebski, git
In-Reply-To: <46a038f90606201233p6283febbn9a46e36c3a666903@mail.gmail.com>
Martin Langhoff wrote:
> And, as you mention in your other post, mod_perl support. And a bit of
> speed. Gitweb rght now is really really slow.
A few days ago I have tried to run gitweb under mod_perl and these
are my results. All of this hasn't got any real testing, so this is
more a request for comment. I had to make two changes to gitweb to
get it running as a Registry script with mod_perl:
(1) With mod_perl you cannot access variables which were defined
with "my" on file scope from subroutines. Unless gitweb becomes
split in separate packages the easiest solution is probably to
use "our" to declare them.
(2) Setting %ENV has no effect on spawned processes under mod_perl,
so the git commands would never find the project directories.
My first thought was to set $GIT_DIR on the commands' command
lines like in open($fh, '$GIT_DIR=blah git-rev-list ...') but it
would lead to an extra shell being spawned on every invocation
of a git command.
So I added the possibility to set/override the path to the
repository with a command line parameter. For simplicity I
handled that parameter in git.c. The drawbacks are that it has
to be given before the command name and that it won't work when
commands are invoked as "git-command".
The gains vary hugely. Inexpensive views like the title page, blob
and commit view are sped up by a factor of 5 to 8 for successive
requests. The project summary in contrast issues quite a number of
calls to git, so the speedup is only a few percent for it.
Regards,
Dennis
^ permalink raw reply
* [PATCH 1/3] gitweb: Declare global variables with "our"
From: Dennis Stosberg @ 2006-06-21 13:07 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Jakub Narebski, git
In-Reply-To: <20060621130535.G2b34d382@leonov.stosberg.net>
Variables declared with "my" in the file scope cannot be accessed from
subroutines with mod_perl.
---
gitweb/gitweb.cgi | 55 ++++++++++++++++++++++++++---------------------------
1 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index ef7fcbd..8f19fdb 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -16,21 +16,21 @@ use Encode;
use Fcntl ':mode';
binmode STDOUT, ':utf8';
-my $cgi = new CGI;
-my $version = "267";
-my $my_url = $cgi->url();
-my $my_uri = $cgi->url(-absolute => 1);
-my $rss_link = "";
+our $cgi = new CGI;
+our $version = "267";
+our $my_url = $cgi->url();
+our $my_uri = $cgi->url(-absolute => 1);
+our $rss_link = "";
# location of the git-core binaries
-my $gitbin = "/usr/bin";
+our $gitbin = "/usr/bin";
# absolute fs-path which will be prepended to the project path
-#my $projectroot = "/pub/scm";
-my $projectroot = "/home/kay/public_html/pub/scm";
+#our $projectroot = "/pub/scm";
+our $projectroot = "/home/kay/public_html/pub/scm";
# version of the git-core binaries
-my $git_version = qx($gitbin/git --version);
+our $git_version = qx($gitbin/git --version);
if ($git_version =~ m/git version (.*)$/) {
$git_version = $1;
} else {
@@ -38,32 +38,31 @@ if ($git_version =~ m/git version (.*)$/
}
# location for temporary files needed for diffs
-my $git_temp = "/tmp/gitweb";
+our $git_temp = "/tmp/gitweb";
# target of the home link on top of all pages
-my $home_link = $my_uri;
+our $home_link = $my_uri;
# html text to include at home page
-my $home_text = "indextext.html";
+our $home_text = "indextext.html";
# URI of default stylesheet
-my $stylesheet = "gitweb.css";
+our $stylesheet = "gitweb.css";
# source of projects list
-#my $projects_list = $projectroot;
-my $projects_list = "index/index.aux";
+#our $projects_list = $projectroot;
+our $projects_list = "index/index.aux";
# default blob_plain mimetype and default charset for text/plain blob
-my $default_blob_plain_mimetype = 'text/plain';
-my $default_text_plain_charset = undef;
+our $default_blob_plain_mimetype = 'text/plain';
+our $default_text_plain_charset = undef;
# file to use for guessing MIME types before trying /etc/mime.types
# (relative to the current git repository)
-my $mimetypes_file = undef;
-
+our $mimetypes_file = undef;
# input validation and dispatch
-my $action = $cgi->param('a');
+our $action = $cgi->param('a');
if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
undef $action;
@@ -78,7 +77,7 @@ if (defined $action) {
}
}
-my $order = $cgi->param('o');
+our $order = $cgi->param('o');
if (defined $order) {
if ($order =~ m/[^0-9a-zA-Z_]/) {
undef $order;
@@ -86,7 +85,7 @@ if (defined $order) {
}
}
-my $project = $cgi->param('p');
+our $project = $cgi->param('p');
if (defined $project) {
$project = validate_input($project);
if (!defined($project)) {
@@ -108,7 +107,7 @@ if (defined $project) {
exit;
}
-my $file_name = $cgi->param('f');
+our $file_name = $cgi->param('f');
if (defined $file_name) {
$file_name = validate_input($file_name);
if (!defined($file_name)) {
@@ -116,7 +115,7 @@ if (defined $file_name) {
}
}
-my $hash = $cgi->param('h');
+our $hash = $cgi->param('h');
if (defined $hash) {
$hash = validate_input($hash);
if (!defined($hash)) {
@@ -124,7 +123,7 @@ if (defined $hash) {
}
}
-my $hash_parent = $cgi->param('hp');
+our $hash_parent = $cgi->param('hp');
if (defined $hash_parent) {
$hash_parent = validate_input($hash_parent);
if (!defined($hash_parent)) {
@@ -132,7 +131,7 @@ if (defined $hash_parent) {
}
}
-my $hash_base = $cgi->param('hb');
+our $hash_base = $cgi->param('hb');
if (defined $hash_base) {
$hash_base = validate_input($hash_base);
if (!defined($hash_base)) {
@@ -140,7 +139,7 @@ if (defined $hash_base) {
}
}
-my $page = $cgi->param('pg');
+our $page = $cgi->param('pg');
if (defined $page) {
if ($page =~ m/[^0-9]$/) {
undef $page;
@@ -148,7 +147,7 @@ if (defined $page) {
}
}
-my $searchtext = $cgi->param('s');
+our $searchtext = $cgi->param('s');
if (defined $searchtext) {
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
undef $searchtext;
--
1.4.0
^ permalink raw reply related
* [PATCH 2/3] Add a parameter to specify the repository path
From: Dennis Stosberg @ 2006-06-21 13:08 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Jakub Narebski, git
In-Reply-To: <20060621130535.G2b34d382@leonov.stosberg.net>
---
builtin-help.c | 2 +-
git.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index 7470faa..db233eb 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -10,7 +10,7 @@ #include "exec_cmd.h"
#include "common-cmds.h"
static const char git_usage[] =
- "Usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ ARGS ]";
+ "Usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--git-dir=GIT_DIR] [--help] COMMAND [ ARGS ]";
/* most gui terms set COLUMNS (although some don't export it) */
static int term_columns(void)
diff --git a/git.c b/git.c
index 94e9a4a..d49f626 100644
--- a/git.c
+++ b/git.c
@@ -277,6 +277,12 @@ int main(int argc, const char **argv, ch
puts(git_exec_path());
exit(0);
}
+
+ if (!strncmp(cmd, "git-dir=", 8)) {
+ setenv("GIT_DIR", cmd + 8, 1);
+ continue;
+ }
+
cmd_usage(0, NULL, NULL);
}
argv[0] = cmd;
--
1.4.0
^ permalink raw reply related
* [PATCH 3/3] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}
From: Dennis Stosberg @ 2006-06-21 13:09 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Jakub Narebski, git
In-Reply-To: <20060621130535.G2b34d382@leonov.stosberg.net>
---
gitweb/gitweb.cgi | 67 +++++++++++++++++++++++++++--------------------------
1 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 8f19fdb..57ac3a3 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -61,6 +61,9 @@ # file to use for guessing MIME types be
# (relative to the current git repository)
our $mimetypes_file = undef;
+# path to the project's repository
+our $git_dir = undef;
+
# input validation and dispatch
our $action = $cgi->param('a');
if (defined $action) {
@@ -101,7 +104,7 @@ if (defined $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";
+ $git_dir = "$projectroot/$project";
} else {
git_project_list();
exit;
@@ -372,7 +375,7 @@ sub die_error {
sub git_get_type {
my $hash = shift;
- open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file -t $hash" or return;
my $type = <$fd>;
close $fd or return;
chomp $type;
@@ -381,19 +384,15 @@ sub git_get_type {
sub git_read_head {
my $project = shift;
- my $oENV = $ENV{'GIT_DIR'};
my $retval = undef;
- $ENV{'GIT_DIR'} = "$projectroot/$project";
- if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
+
+ if (open my $fd, "-|", "$gitbin/git", "--git-dir=$projectroot/$project", "rev-parse", "--verify", "HEAD") {
my $head = <$fd>;
close $fd;
if (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {
$retval = $1;
}
}
- if (defined $oENV) {
- $ENV{'GIT_DIR'} = $oENV;
- }
return $retval;
}
@@ -424,7 +423,7 @@ sub git_read_tag {
my %tag;
my @comment;
- open my $fd, "-|", "$gitbin/git-cat-file tag $tag_id" or return;
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file tag $tag_id" or return;
$tag{'id'} = $tag_id;
while (my $line = <$fd>) {
chomp $line;
@@ -496,7 +495,7 @@ sub git_read_commit {
@commit_lines = @$commit_text;
} else {
$/ = "\0";
- open my $fd, "-|", "$gitbin/git-rev-list --header --parents --max-count=1 $commit_id" or return;
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list --header --parents --max-count=1 $commit_id" or return;
@commit_lines = split '\n', <$fd>;
close $fd or return;
$/ = "\n";
@@ -594,7 +593,7 @@ sub git_diff_print {
if (defined $from) {
$from_tmp = "$git_temp/gitweb_" . $$ . "_from";
open my $fd2, "> $from_tmp";
- open my $fd, "-|", "$gitbin/git-cat-file blob $from";
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file blob $from";
my @file = <$fd>;
print $fd2 @file;
close $fd2;
@@ -605,7 +604,7 @@ sub git_diff_print {
if (defined $to) {
$to_tmp = "$git_temp/gitweb_" . $$ . "_to";
open my $fd2, "> $to_tmp";
- open my $fd, "-|", "$gitbin/git-cat-file blob $to";
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file blob $to";
my @file = <$fd>;
print $fd2 @file;
close $fd2;
@@ -844,10 +843,12 @@ sub git_project_list {
}
foreach my $pr (@list) {
my $head = git_read_head($pr->{'path'});
+ print STDERR $head;
+
if (!defined $head) {
next;
}
- $ENV{'GIT_DIR'} = "$projectroot/$pr->{'path'}";
+ $git_dir = "$projectroot/$pr->{'path'}";
my %co = git_read_commit($head);
if (!%co) {
next;
@@ -1046,7 +1047,7 @@ sub git_summary {
"<tr><td>owner</td><td>$owner</td></tr>\n" .
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
"</table>\n";
- open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_head($project) or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list --max-count=17 " . git_read_head($project) or die_error(undef, "Open failed.");
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd;
print "<div>\n" .
@@ -1224,7 +1225,7 @@ sub git_tag {
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);
@@ -1234,7 +1235,7 @@ sub git_blame {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
or die_error(undef, "Error lookup file.");
}
- open ($fd, "-|", "$gitbin/git-annotate", '-l', '-t', '-r', $file_name, $hash_base)
+ open ($fd, "-|", "$gitbin/git", "--git-dir=$git_dir", "annotate", '-l', '-t', '-r', $file_name, $hash_base)
or die_error(undef, "Open failed.");
git_header_html();
print "<div class=\"page_nav\">\n" .
@@ -1429,7 +1430,7 @@ sub git_get_hash_by_path {
my $tree = $base;
my @parts = split '/', $path;
while (my $part = shift @parts) {
- open my $fd, "-|", "$gitbin/git-ls-tree $tree" or die_error(undef, "Open git-ls-tree failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir ls-tree $tree" or die_error(undef, "Open git-ls-tree failed.");
my (@entries) = map { chomp; $_ } <$fd>;
close $fd or return undef;
foreach my $line (@entries) {
@@ -1457,8 +1458,8 @@ sub git_blob {
my $base = $hash_base || git_read_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
}
- my $have_blame = git_get_project_config_bool ('blame');
- open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
+ my $have_blame = 1; #git_get_project_config_bool ('blame');
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file blob $hash" or die_error(undef, "Open failed.");
git_header_html();
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
print "<div class=\"page_nav\">\n" .
@@ -1570,7 +1571,7 @@ sub git_blob_plain_mimetype {
}
sub git_blob_plain {
- open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or return;
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file blob $hash" or return;
my $type = git_blob_plain_mimetype($fd, $file_name);
# save as filename, even when no $file_name is given
@@ -1602,7 +1603,7 @@ sub git_tree {
}
}
$/ = "\0";
- open my $fd, "-|", "$gitbin/git-ls-tree -z $hash" or die_error(undef, "Open git-ls-tree failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir ls-tree -z $hash" or die_error(undef, "Open git-ls-tree failed.");
chomp (my (@entries) = <$fd>);
close $fd or die_error(undef, "Reading tree failed.");
$/ = "\n";
@@ -1683,7 +1684,7 @@ # " | " . $cgi->a({-href => "$my
sub git_rss {
# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
- open my $fd, "-|", "$gitbin/git-rev-list --max-count=150 " . git_read_head($project) or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list --max-count=150 " . git_read_head($project) or die_error(undef, "Open failed.");
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading rev-list failed.");
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
@@ -1703,7 +1704,7 @@ sub git_rss {
last;
}
my %cd = date_str($co{'committer_epoch'});
- open $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $co{'id'}" or next;
+ open $fd, "-|", "$gitbin/git --git-dir=$git_dir diff-tree -r $co{'parent'} $co{'id'}" or next;
my @difftree = map { chomp; $_ } <$fd>;
close $fd or next;
print "<item>\n" .
@@ -1756,7 +1757,7 @@ sub git_opml {
if (!defined $head) {
next;
}
- $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
+ $git_dir = "$projectroot/$proj{'path'}";
my %co = git_read_commit($head);
if (!%co) {
next;
@@ -1791,7 +1792,7 @@ sub git_log {
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
- open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list $limit $hash" or die_error(undef, "Open failed.");
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd;
@@ -1882,7 +1883,7 @@ sub git_commit {
$root = " --root";
$parent = "";
}
- open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed.");
@difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
@@ -2124,7 +2125,7 @@ sub git_commitdiff {
if (!defined $hash_parent) {
$hash_parent = $co{'parent'};
}
- open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
@@ -2214,14 +2215,14 @@ sub git_commitdiff {
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
- open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
my (@difftree) = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
# try to figure out the next tag after this commit
my $tagname;
my $refs = read_info_ref("tags");
- open $fd, "-|", "$gitbin/git-rev-list HEAD";
+ open $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list HEAD";
chomp (my (@commits) = <$fd>);
close $fd;
foreach my $commit (@commits) {
@@ -2291,7 +2292,7 @@ sub git_history {
"</div>\n";
print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
- open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -- \'$file_name\'";
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list $hash | $gitbin/git --git-dir=$git_dir diff-tree -r --stdin -- \'$file_name\'";
my $commit;
print "<table cellspacing=\"0\">\n";
my $alternate = 0;
@@ -2383,7 +2384,7 @@ sub git_search {
my $alternate = 0;
if ($commit_search) {
$/ = "\0";
- open my $fd, "-|", "$gitbin/git-rev-list --header --parents $hash" or next;
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list --header --parents $hash" or next;
while (my $commit_text = <$fd>) {
if (!grep m/$searchtext/i, $commit_text) {
next;
@@ -2433,7 +2434,7 @@ sub git_search {
if ($pickaxe_search) {
$/ = "\n";
- open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -S\'$searchtext\'";
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list $hash | $gitbin/git --git-dir=$git_dir diff-tree -r --stdin -S\'$searchtext\'";
undef %co;
my @files;
while (my $line = <$fd>) {
@@ -2504,7 +2505,7 @@ sub git_shortlog {
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
- open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
+ open my $fd, "-|", "$gitbin/git --git-dir=$git_dir rev-list $limit $hash" or die_error(undef, "Open failed.");
my (@revlist) = map { chomp; $_ } <$fd>;
close $fd;
--
1.4.0
^ permalink raw reply related
* [PATCH] Check and document the options to prevent mistakes.
From: Eric W. Biederman @ 2006-06-21 13:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
When multiple recipients are given to git-send-email on the same
--cc line the code does not properly handle it.
Full and proper parsing of the email addresses so I can detect
which commas mean a new email address is more than I care to implement.
In particular this email address: "bibo,mao" <bibo.mao@intel.com>
must not be treated as two email addresses.
So this patch simply treats all commas in recipient lists as
an error and fails if one is given.
At the same time it documents that git-send-email wants multiple
instances of --cc specified on the command line if you want to
cc multiple recipients.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
Documentation/git-send-email.txt | 9 +++++++++
git-send-email.perl | 14 ++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ad1b9cf..481b3f5 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -24,9 +24,16 @@ OPTIONS
-------
The options available are:
+--bcc::
+ Specify a "Bcc:" value for each email.
+
+ The --bcc option must be repeated for each user you want on the bcc list.
+
--cc::
Specify a starting "Cc:" value for each email.
+ The --cc option must be repeated for each user you want on the cc list.
+
--chain-reply-to, --no-chain-reply-to::
If this is set, each email will be sent as a reply to the previous
email sent. If disabled with "--no-chain-reply-to", all emails after
@@ -76,6 +83,8 @@ The options available are:
Generally, this will be the upstream maintainer of the
project involved.
+ The --to option must be repeated for each user you want on the to list.
+
Author
------
diff --git a/git-send-email.perl b/git-send-email.perl
index 7b1cca7..c5d9e73 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -65,6 +65,20 @@ my $rc = GetOptions("from=s" => \$from,
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
);
+# Verify the user input
+
+foreach my $entry (@to) {
+ die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@initial_cc) {
+ die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@bcclist) {
+ die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/;
+}
+
# Now, let's fill any that aren't set in with defaults:
sub gitvar {
^ permalink raw reply related
* Re: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 13:30 UTC (permalink / raw)
To: git
In-Reply-To: <20060621130535.G2b34d382@leonov.stosberg.net>
Dennis Stosberg wrote:
> (2) Setting %ENV has no effect on spawned processes under mod_perl,
> so the git commands would never find the project directories.
> My first thought was to set $GIT_DIR on the commands' command
> lines like in open($fh, '$GIT_DIR=blah git-rev-list ...') but it
> would lead to an extra shell being spawned on every invocation
> of a git command.
>
> So I added the possibility to set/override the path to the
> repository with a command line parameter. For simplicity I
> handled that parameter in git.c. The drawbacks are that it has
> to be given before the command name and that it won't work when
> commands are invoked as "git-command".
So now you have extra git redirector being spawned, instead of extra shell
being spawned. I wonder if using 'env' wouldn't be simplier, and how
portable 'env' is.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}
From: Timo Hirvonen @ 2006-06-21 13:33 UTC (permalink / raw)
To: Dennis Stosberg; +Cc: martin.langhoff, jnareb, git
In-Reply-To: <20060621130930.G421234bb@leonov.stosberg.net>
Dennis Stosberg <dennis@stosberg.net> wrote:
> - open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
> + open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file -t $hash" or return;
How about adding a function to simplify calling the git commands?
Something like git("cat-file -t $hash") which would return
"$gitbin/git --git-dir=$git_dir cat-file -t $hash" string.
I'm not Perl programmer so I don't know what would be the best way to
do this.
--
http://onion.dynserv.net/~timo/
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}
From: Jakub Narebski @ 2006-06-21 13:42 UTC (permalink / raw)
To: git
In-Reply-To: <20060621163302.47271f89.tihirvon@gmail.com>
Timo Hirvonen wrote:
> Dennis Stosberg <dennis@stosberg.net> wrote:
>
>> - open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
>> + open my $fd, "-|", "$gitbin/git --git-dir=$git_dir cat-file -t $hash" or return;
>
> How about adding a function to simplify calling the git commands?
>
> Something like git("cat-file -t $hash") which would return
> "$gitbin/git --git-dir=$git_dir cat-file -t $hash" string.
Or rather add a function(s) to call git commands, either returning git command
output, or filehandle to read from, e.g.
my $fd = git_open("cat-file", "-t $hash") or return;
i.e. each parameter separately, just in case.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 13:53 UTC (permalink / raw)
To: git
In-Reply-To: <200606211157.23809.Josef.Weidendorfer@gmx.de>
Josef Weidendorfer wrote:
> On Wednesday 21 June 2006 11:15, Jakub Narebski wrote:
>> Josef Weidendorfer wrote:
>>
>>> It would be nice to have a list of the files in the directory
>>> touched by the given commits.
>>
>> 'commit' view gives at the bottom list of all files affected by given
>> commit.
>
> Yup, but when you are interested in the history of changes to files in
> a given directory, you also want to see the name of the changed files on
> the same page, and not have to click on every commit to get the file
> names. Besides, the "commit" view shows all changed files, and not only
> the ones which are in the directory.
Could you please create a mockup how you imagine the page to look like
(in ascii-art)? At least list the columns...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] gitweb: Make use of $PATH_INFO for project parameter
From: Jakub Narebski @ 2006-06-21 14:47 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
Allow to have project name in the path part of URL, just after the name of
script. For example instead of gitweb.cgi?p=git.git you can write
gitweb.cgi/git.git or gitweb.cgi/git.git/
Not used in URLs inside gitweb; it means that the above alternate syntax
must be generated by hand, at least for now.
Side effect: project name parameter is now stripped of leading and
trailing slash before validation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
51faac72f83777ced3d9d3544cc6d47431d1b8ee
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..91698df 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -86,7 +86,8 @@ if (defined $order) {
}
}
-my $project = $cgi->param('p');
+my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
+$project =~ s|^/||; $project =~ s|/$||;
if (defined $project) {
$project = validate_input($project);
if (!defined($project)) {
--
1.3.0
^ permalink raw reply related
* Re: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 14:52 UTC (permalink / raw)
To: git
In-Reply-To: <20060620175505.GR2609@pasky.or.cz>
Petr Baudis wrote:
> Nope, you get the stuff in $PATH_INFO. And having at least just the
> project name in the path part would be quite nice, it's my common gripe
> with cvsweb as I frequently get to mangle with the query part manually
> (can be much faster than clicking around) and I have to carefully evade
> the project name part, which is something I would really expect to be in
> the "static" part of the URL.
What about the patch I just sent: "[PATCH] gitweb: Make use of $PATH_INFO
for project parameter" (<11509012742493-git-send-email-jnareb@gmail.com>)?
It doesn't as of yet make use of that.
I wonder if this solution would work for mod_perl, or one would need some
Apache-specific package...
P.S. I meant to sent the patch as reply to this mail. Oops.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH (amend)] gitweb: Make use of $PATH_INFO for project parameter
From: Jakub Narebski @ 2006-06-21 15:03 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <11509012742493-git-send-email-jnareb@gmail.com>
Allow to have project name in the path part of URL, just after the name of
script. For example instead of gitweb.cgi?p=git.git you can write
gitweb.cgi/git.git or gitweb.cgi/git.git/
Not used in URLs inside gitweb; it means that the above alternate syntax
must be generated by hand, at least for now.
Side effect: project name parameter is now stripped of leading and
trailing slash before validation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
63ffc79283d23aeedbdc259e3b069f1e97498e09
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..91698df 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -86,7 +86,8 @@ if (defined $order) {
}
}
-my $project = $cgi->param('p');
+my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
+$project =~ s|^/||; $project =~ s|/$||;
if (defined $project) {
$project = validate_input($project);
if (!defined($project)) {
--
1.3.0
^ permalink raw reply related
* [PATCH] gitweb: Make use of $PATH_INFO for project parameter
From: Jakub Narebski @ 2006-06-21 15:06 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <11509012742493-git-send-email-jnareb@gmail.com>
Allow to have project name in the path part of URL, just after the name of
script. For example instead of gitweb.cgi?p=git.git you can write
gitweb.cgi/git.git or gitweb.cgi/git.git/
Not used in URLs inside gitweb; it means that the above alternate syntax
must be generated by hand, at least for now.
Side effect: project name parameter is now stripped of leading and
trailing slash before validation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is final, correct version of the patch.
gitweb/gitweb.cgi | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
b9df055ae8d3aafe03744537026823dbaf7342ba
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..e2108de 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -86,8 +86,9 @@ if (defined $order) {
}
}
-my $project = $cgi->param('p');
+my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
if (defined $project) {
+ $project =~ s|^/||; $project =~ s|/$||;
$project = validate_input($project);
if (!defined($project)) {
die_error(undef, "Invalid project parameter.");
--
1.3.0
^ permalink raw reply related
* Re: packs and trees
From: David Lang @ 2006-06-21 15:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Martin Langhoff, Nicolas Pitre, Jon Smirl, git
In-Reply-To: <Pine.LNX.4.64.0606202046290.5498@g5.osdl.org>
there are performance penalties in some cases when you use directory hashing. I
did some tests last year of lots of small files in a directory tree (X/X/X/XXX
of 1k files) and I found that turning on directory hashing actually slowed down
the creation of this tree from a tarball significantly (I also found that in
this case the ext2 allocation strategy was significantly better then the ext3
one), so test on your system.
David Lang
On Tue, 20 Jun 2006, Linus Torvalds wrote:
> Date: Tue, 20 Jun 2006 20:54:01 -0700 (PDT)
> From: Linus Torvalds <torvalds@osdl.org>
> To: Martin Langhoff <martin.langhoff@gmail.com>
> Cc: Nicolas Pitre <nico@cam.org>, Jon Smirl <jonsmirl@gmail.com>,
> git <git@vger.kernel.org>
> Subject: Re: packs and trees
>
>
>
> On Wed, 21 Jun 2006, Martin Langhoff wrote:
>>
>> If you are asking about the ext3 performance problems, I think Linus
>> discussed that a while ago, why unpacked repos are slow (in addition
>> to huge), and there were some suggestions of using hashed directory
>> indexes.
>
> Yes. I think most distros still default to nonhashed directories, but for
> any large-directory case you really want to turn on hashing.
>
> I forget the exact details, it's somethng like
>
> tune2fs -O dir_index
>
> or something to turn it on (if I remember correctly, that will only affect
> any directories then created after that, but you can effect that by just
> doing a "git repack -a -d" which will remove all old object directories,
> and now subsequent directories will be done with indexing on).
>
> Personally, I just ended up using packs extensively, so I think I'm still
> running without indexing on all my machines ;)
>
> Linus
> -
> 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: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 16:38 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: git
In-Reply-To: <200606211802.41071.Josef.Weidendorfer@gmx.de>
Josef Weidendorfer wrote:
> On Wednesday 21 June 2006 15:53, Jakub Narebski wrote:
>>> Yup, but when you are interested in the history of changes to files in
>>> a given directory, you also want to see the name of the changed files on
>>> the same page, and not have to click on every commit to get the file
>>> names. Besides, the "commit" view shows all changed files, and not only
>>> the ones which are in the directory.
>>
>> Could you please create a mockup how you imagine the page to look like
>> (in ascii-art)? At least list the columns...
>
> Let's see. A think a mixture between current history and log...
> Currently, it looks like this
>
> http://git.kernel.org/git/?p=git/git.git;a=history;f=Documentation
>
> gives you the history of subdirectory Documentation/ of git
> (unfortunately only reachable via changing the URL...).
>
> And it could look as attached (I did a little copy/paste of
> HTML). I only modified 2 commits of the list...
It probably didn't get to mailing list (at least to archives) due
to having attachement.
I thought you wanted to enhance tree view, e.g. adding to the view like in
http://git.kernel.org/git/?p=git/git.git;a=tree;f=Documentation
columns 'Changed by' or 'Author', 'Age' or 'Last changed', 'Commit'
(i.e. abbreviated sha1 id of a commit), and perhaps shortened commit
message (short description of changes, a la shortlog but shorther).
In other words 'blame'/'annotate' for directory. Which would need new git
command I think.
Adding filtered list of files modified by commit in log and history views
should be fairly easy...
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Ryan Anderson @ 2006-06-21 16:45 UTC (permalink / raw)
To: Dennis Stosberg; +Cc: Martin Langhoff, Jakub Narebski, git
In-Reply-To: <20060621130535.G2b34d382@leonov.stosberg.net>
On Wed, Jun 21, 2006 at 03:05:35PM +0200, Dennis Stosberg wrote:
> (2) Setting %ENV has no effect on spawned processes under mod_perl,
> so the git commands would never find the project directories.
> My first thought was to set $GIT_DIR on the commands' command
> lines like in open($fh, '$GIT_DIR=blah git-rev-list ...') but it
> would lead to an extra shell being spawned on every invocation
> of a git command.
I haven't looked at gitweb much, but why can't you solve this by doing
manual pipe,fork,exec combinations? That should give you complete
control over the environment, right?
(IIRC, the last time I played with mod_perl and spawning processes, I
recall it doing something very confusing with the pipes I had open.)
--
Ryan Anderson
sometimes Pug Majere
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 17:36 UTC (permalink / raw)
To: git
In-Reply-To: <20060621164503.GA1285@h4x0r5.com>
Ryan Anderson wrote:
> On Wed, Jun 21, 2006 at 03:05:35PM +0200, Dennis Stosberg wrote:
>> (2) Setting %ENV has no effect on spawned processes under mod_perl,
>> so the git commands would never find the project directories.
>> My first thought was to set $GIT_DIR on the commands' command
>> lines like in open($fh, '$GIT_DIR=blah git-rev-list ...') but it
>> would lead to an extra shell being spawned on every invocation
>> of a git command.
>
> I haven't looked at gitweb much, but why can't you solve this by doing
> manual pipe,fork,exec combinations? That should give you complete
> control over the environment, right?
In gitweb.cgi we now use magic open "-|" invocation, e.g.:
open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
in git-rerere we still fork magically, but exec explicitely
my $pid = open($in, '-|');
die "$!" unless defined $pid;
if (!$pid) {
exec(qw(git ls-files -z -u)) or die "$!: ls-files";
}
The same is done in git-annotate (via open_pipe sub which takes care of
ActiveState Perl implementation); git-archimport, git-cvsexportcommit
(via safe_pipe_capture); git-send-email (without encapsulating in
a subroutine; it also uses backticks)
git-svn uses fork + redirecting output + exec and waitpid for quiet_run
subroutine and system call.
git-cvsimport uses system call, backticks, straight pipe open, i.e. using
"git-command |", and magic open "-|" like gitweb.cgi. git-cvsserver has
safe_pipe_capture, but sometimes uses backticks. git-fmt-merge-message uses
backticks only. git-mv uses backticks and pipe. git-svnimport uses system
call and pipe.
What a mess. We really need Git.pm module...
And to answer your question, AFAICT exec cannot modify environment, not like
execve (or execle wrapper). POE (POE::Wheel::Run) or IPC::Run modules
perhaps...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Odd behavior with git and cairo-devel repo
From: Andre Noll @ 2006-06-21 17:46 UTC (permalink / raw)
To: Art Haas; +Cc: Junio C Hamano, git, Linus Torvalds
In-Reply-To: <20060621120618.GR2820@artsapartment.org>
On 07:06, Art Haas wrote:
> I see this patch has made it into git now, and it fixes the problem
> described above. Thanks!
>
> However, I'm still seeing the problem where 'git prune' leaves the
> repo in an invalid state. In the case above, running 'git prune' on a
> freshly checked-out repo works without problems; when the repo has a
> number of unpacked objects, however, things go bad. On the FC4 machine
> I have, I updated my git repo, rebuilt, and installed the build with
> the patch above, then updated my cairo repo. The 'git pull' retrieved
> a handful of objects, and 'git fsck-objects' ran without problem.
> Then 'git prune' was run, seemingly without problem, and when I tried
> 'git repack -a -d' things went boom. A subsequent 'git fsck-object'
> run indicated the repo was missing tree and commit objects.
>
> Is anyone else seeing a similar problem with 'git prune'?
Yeah. This is due to a thinko in grow_refs_hash() which was introduced in
commit 3e4339e6f96e8c4f38a9c6607b98d3e96a2ed783
Author: Linus Torvalds <torvalds@osdl.org>
Date: Sun Jun 18 11:45:02 2006 -0700
Remove "refs" field from "struct object"
Fix below.
---
Fix grow_refs_hash()
As the hash values depend on the hash size, they have to be
recalulated when growing the hash. It's possible (though unlikely)
that there are duplicates even with the new, larger hash size, so
make grow_refs_hash() check for duplicates.
Signed-off-by: Andre Noll <maan@systemlinux.org>
---
diff --git a/object-refs.c b/object-refs.c
index 8afa227..fa1d3c1 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -25,6 +25,8 @@ static void grow_refs_hash(void)
if (!ref)
continue;
j = hash_obj(ref->base, new_hash_size);
+ while (new_hash[j])
+ j = (j + 1) % new_hash_size;
new_hash[j] = ref;
}
free(refs_hash);
--
The only person who always got his work done by Friday was Robinson Crusoe
^ permalink raw reply related
* Re: Odd behavior with git and cairo-devel repo
From: Linus Torvalds @ 2006-06-21 18:01 UTC (permalink / raw)
To: Andre Noll; +Cc: Art Haas, Junio C Hamano, git
In-Reply-To: <20060621174632.GP11245@skl-net.de>
On Wed, 21 Jun 2006, Andre Noll wrote:
>
> Fix grow_refs_hash()
Ouch.
Actually, the alternate patch is the one I had intended to do but for some
reasons didn't.
This one also removes two more lines than it adds, but it's obviously a
bigger patch.
Junio, depending on which one you prefer, add the appropriate
Acked-by: Linus Torvalds <torvalds@osdl.org>
(for Andre's one) or
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
if you take this one.
Linus
---
object-refs.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/object-refs.c b/object-refs.c
index a7d49c6..b1b8065 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -12,6 +12,18 @@ static unsigned int hash_obj(struct obje
return hash % n;
}
+static void insert_ref_hash(struct object_refs *ref, struct object_refs **hash, unsigned int size)
+{
+ int j = hash_obj(ref->base, size);
+
+ while (hash[j]) {
+ j++;
+ if (j >= size)
+ j = 0;
+ }
+ hash[j] = ref;
+}
+
static void grow_refs_hash(void)
{
int i;
@@ -20,30 +32,16 @@ static void grow_refs_hash(void)
new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
for (i = 0; i < refs_hash_size; i++) {
- int j;
struct object_refs *ref = refs_hash[i];
if (!ref)
continue;
- j = hash_obj(ref->base, new_hash_size);
- new_hash[j] = ref;
+ insert_ref_hash(ref, new_hash, new_hash_size);
}
free(refs_hash);
refs_hash = new_hash;
refs_hash_size = new_hash_size;
}
-static void insert_ref_hash(struct object_refs *ref)
-{
- int j = hash_obj(ref->base, refs_hash_size);
-
- while (refs_hash[j]) {
- j++;
- if (j >= refs_hash_size)
- j = 0;
- }
- refs_hash[j] = ref;
-}
-
static void add_object_refs(struct object *obj, struct object_refs *ref)
{
int nr = nr_object_refs + 1;
@@ -51,7 +49,7 @@ static void add_object_refs(struct objec
if (nr > refs_hash_size * 2 / 3)
grow_refs_hash();
ref->base = obj;
- insert_ref_hash(ref);
+ insert_ref_hash(ref, refs_hash, refs_hash_size);
nr_object_refs = nr;
}
^ permalink raw reply related
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