* [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 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
* 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
* 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: 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
* 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: [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
* [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: 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
* Re: [PATCH (fixed)] rebase: Allow merge strategies to be used when rebasing
From: Junio C Hamano @ 2006-06-21 11:01 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <11508842824018-git-send-email-normalperson@yhbt.net>
Eric Wong <normalperson@yhbt.net> writes:
> 1 - is fixed for --onto usage.
More importantly, it used to rebase "side edits further" commit
incorrectly in the test sequence -- the commit should only touch
"newfile", but it touched "renamed" as well. Your updated patch
fixes this problem.
^ permalink raw reply
* Re: [PATCH] rebase: Allow merge strategies to be used when rebasing
From: Junio C Hamano @ 2006-06-21 11:01 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20060621100138.GA15748@localdomain>
Eric Wong <normalperson@yhbt.net> writes:
> Junio C Hamano <junkio@cox.net> wrote:
>>
>> >> git-merge-$strategy $cmt^ -- HEAD $cmt
>> >
>> > Changing the 'git-merge $strategy_args "rebase-merge: $cmt" HEAD "$cmt"'
>> > line in call_merge() to this seems to have broken more tests.
>>
>> Oh, that is to be expected if you changed git-merge -s recursive
>> with git-merge-recursive without other changes. The former
>> makes a commit (which your original patch later used to create a
>> separate commit chain and discarded); the latter does not make a
>> commit but expects the caller to create a commit out of the
>> resulting index file.
>
> Oops, *smacks head*
Well, but you used it to do the right thing after all ;-).
The patch looks quite good.
>> I was originally hoping that rebasing would just be a matter of
>> listing sequence of commits to be ported onto a new base and
>> running "git-cherry-pick" on each of them in sequence. Now
>> cherry-pick does not use merge machinery (hence does not use
>> git-merge-recursive), but if we change that then updating rebase
>> would be pretty much straightforward. It just needs a UI layer
>> to guide the user through recovery process when the merge does
>> not resolve cleanly in the middle, no?
>
> Sounds workable right to me. But then again, a cherry-pick is also a
> case of rebase on a single commit, so we could be using rebase (and its
> recovery code) in cherry-pick, too, right?
Revert and cherry-pick are quite similar operation (the only
difference is that you swap his and pivot when doing revert), so
when you implement cherry-pick as an atomic operation you can
have revert almost for free. If you have a rebase like you did,
it would be a bit more involved to make it do revert as well.
^ permalink raw reply
* Re: [PATCH] Fix possible out-of-bounds array access
From: Junio C Hamano @ 2006-06-21 11:01 UTC (permalink / raw)
To: Uwe Zeisberger; +Cc: git
In-Reply-To: <20060621090412.GA9267@informatik.uni-freiburg.de>
Thanks.
^ permalink raw reply
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale
From: Eric Wong @ 2006-06-21 10:49 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <e7b796$lj$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> wrote:
> Jakub Narebski wrote:
>
> > $ENV{LC_ALL} = 'C'; does not change locale used by strftime.
> > Use setlocale( LC_ALL, 'C' ); instead.
>
> > # most mail servers generate the Date: header, but not all...
> > $ENV{LC_ALL} = 'C';
> > -use POSIX qw/strftime/;
> > +use POSIX qw/strftime setlocale LC_ALL/;
> > +setlocale( &LC_ALL, 'C' );
>
> Perhaps instead of
> setlocale( &LC_ALL, 'C' );
> we should use
> setlocale( &LC_ALL, '' );
> (i.e. set the LC_ALL behaviour according to the locale environment
> variables). I'm not that versed in locale, POSIX and Perl.
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).
I've always wondered about why /usr/bin/822-date existed without
strftime on my Debian systems but never bothered asking, I guess this
could be a good reason why...
For reference, here's the /usr/bin/822-date script
(trailing whitespace fixed):
------- 8< -------
#!/usr/bin/perl --
# I hereby place this in the public domain - Ian Jackson, 1995.
# Changes by Klee Dienes also placed in public domain (1997).
# time structure:
# [ sec min hour mday mon year wday yday isdst ]
@ARGV && die "usage: 822-date\n";
$curtime = time;
@localtm = localtime ($curtime);
$localtms = localtime ($curtime);
@gmttm = gmtime ($curtime);
$gmttms = gmtime ($curtime);
if ($localtm[0] != $gmttm[0]) {
die (sprintf ("local timezone differs from GMT by a non-minute interval\n"
. "local time: %s\n"
. "GMT time: %s\n", $localtms, $gmttms));
}
$localmin = $localtm[1] + $localtm[2] * 60;
$gmtmin = $gmttm[1] + $gmttm[2] * 60;
if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
$localmin += 1440;
} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
$localmin -= 1440;
} elsif ($gmttm[6] == $localtm[6]) {
1;
} else {
die ("822-date: local time offset greater than or equal to 24 hours\n");
}
$offset = $localmin - $gmtmin;
$offhour = $offset / 60;
$offmin = abs ($offset % 60);
if (abs ($offhour) >= 24) {
die ("822-date: local time offset greater than or equal to 24 hours\n");
}
printf
(
"%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\n",
(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week
$localtm[3], # day of month
(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month
$localtm[5]+1900, # year
$localtm[2], # hour
$localtm[1], # minute
$localtm[0], # sec
($offset >= 0) ? '+' : '-',# TZ offset direction
abs ($offhour), # TZ offset hour
$offmin, # TZ offset minute
) || die "822-date: output error: $!\n";
------- 8< -------
--
Eric Wong
^ permalink raw reply
* Re: [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale
From: Jakub Narebski @ 2006-06-21 10:33 UTC (permalink / raw)
To: git
In-Reply-To: <11508811631669-git-send-email-jnareb@gmail.com>
Jakub Narebski wrote:
> $ENV{LC_ALL} = 'C'; does not change locale used by strftime.
> Use setlocale( LC_ALL, 'C' ); instead.
> # most mail servers generate the Date: header, but not all...
> $ENV{LC_ALL} = 'C';
> -use POSIX qw/strftime/;
> +use POSIX qw/strftime setlocale LC_ALL/;
> +setlocale( &LC_ALL, 'C' );
Perhaps instead of
setlocale( &LC_ALL, 'C' );
we should use
setlocale( &LC_ALL, '' );
(i.e. set the LC_ALL behaviour according to the locale environment
variables). I'm not that versed in locale, POSIX and Perl.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH 1/3] rebase: Allow merge strategies to be used when rebasing
From: Eric Wong @ 2006-06-21 10:04 UTC (permalink / raw)
To: Junio C Hamano, git; +Cc: Eric Wong
In-Reply-To: <11508842824018-git-send-email-normalperson@yhbt.net>
This solves the problem of rebasing local commits against an
upstream that has renamed files.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Documentation/git-rebase.txt | 20 ++++
git-rebase.sh | 192 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 202 insertions(+), 10 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 08ee4aa..c339c45 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -7,7 +7,7 @@ git-rebase - Rebase local commits to a n
SYNOPSIS
--------
-'git-rebase' [--onto <newbase>] <upstream> [<branch>]
+'git-rebase' [--merge] [--onto <newbase>] <upstream> [<branch>]
'git-rebase' --continue | --skip | --abort
@@ -106,6 +106,24 @@ OPTIONS
--abort::
Restore the original branch and abort the rebase operation.
+--skip::
+ Restart the rebasing process by skipping the current patch.
+ This does not work with the --merge option.
+
+--merge::
+ Use merging strategies to rebase. When the recursive (default) merge
+ strategy is used, this allows rebase to be aware of renames on the
+ upstream side.
+
+-s <strategy>, \--strategy=<strategy>::
+ Use the given merge strategy; can be supplied more than
+ once to specify them in the order they should be tried.
+ If there is no `-s` option, a built-in list of strategies
+ is used instead (`git-merge-recursive` when merging a single
+ head, `git-merge-octopus` otherwise). This implies --merge.
+
+include::merge-strategies.txt[]
+
NOTES
-----
When you rebase a branch, you are changing its history in a way that
diff --git a/git-rebase.sh b/git-rebase.sh
index e6b57b8..bce7bf8 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -34,7 +34,96 @@ When you have resolved this problem run
If you would prefer to skip this patch, instead run \"git rebase --skip\".
To restore the original branch and stop rebasing run \"git rebase --abort\".
"
+
+MRESOLVEMSG="
+When you have resolved this problem run \"git rebase --continue\".
+To restore the original branch and stop rebasing run \"git rebase --abort\".
+"
unset newbase
+strategy=recursive
+do_merge=
+dotest=$GIT_DIR/.dotest-merge
+prec=4
+
+continue_merge () {
+ test -n "$prev_head" || die "prev_head must be defined"
+ test -d "$dotest" || die "$dotest directory does not exist"
+
+ unmerged=$(git-ls-files -u)
+ if test -n "$unmerged"
+ then
+ echo "You still have unmerged paths in your index"
+ echo "did you forget update-index?"
+ die "$MRESOLVEMSG"
+ fi
+
+ if test -n "`git-diff-index HEAD`"
+ then
+ git-commit -C "`cat $dotest/current`"
+ else
+ echo "Previous merge succeeded automatically"
+ fi
+
+ prev_head=`git-rev-parse HEAD^0`
+
+ # save the resulting commit so we can read-tree on it later
+ echo "$prev_head" > "$dotest/`printf %0${prec}d $msgnum`.result"
+ echo "$prev_head" > "$dotest/prev_head"
+
+ # onto the next patch:
+ msgnum=$(($msgnum + 1))
+ printf "%0${prec}d" "$msgnum" > "$dotest/msgnum"
+}
+
+call_merge () {
+ cmt="$(cat $dotest/`printf %0${prec}d $1`)"
+ echo "$cmt" > "$dotest/current"
+ git-merge-$strategy "$cmt^" -- HEAD "$cmt"
+ rv=$?
+ case "$rv" in
+ 0)
+ git-commit -C "$cmt" || die "commit failed: $MRESOLVEMSG"
+ ;;
+ 1)
+ test -d "$GIT_DIR/rr-cache" && git-rerere
+ die "$MRESOLVEMSG"
+ ;;
+ 2)
+ echo "Strategy: $rv $strategy failed, try another" 1>&2
+ die "$MRESOLVEMSG"
+ ;;
+ *)
+ die "Unknown exit code ($rv) from command:" \
+ "git-merge-$strategy $cmt^ -- HEAD $cmt"
+ ;;
+ esac
+}
+
+finish_rb_merge () {
+ set -e
+
+ msgnum=1
+ echo "Finalizing rebased commits..."
+ git-reset --hard "`cat $dotest/onto`"
+ end="`cat $dotest/end`"
+ while test "$msgnum" -le "$end"
+ do
+ msgnum=`printf "%0${prec}d" "$msgnum"`
+ printf "%0${prec}d" "$msgnum" > "$dotest/msgnum"
+
+ git-read-tree `cat "$dotest/$msgnum.result"`
+ git-checkout-index -q -f -u -a
+ git-commit -C "`cat $dotest/$msgnum`"
+
+ echo "Committed $msgnum"
+ echo ' '`git-rev-list --pretty=oneline -1 HEAD | \
+ sed 's/^[a-f0-9]\+ //'`
+ msgnum=$(($msgnum + 1))
+ done
+ rm -r "$dotest"
+ echo "All done."
+}
+
while case "$#" in 0) break ;; esac
do
case "$1" in
@@ -46,17 +135,43 @@ do
exit 1
;;
esac
+ if test -d "$dotest"
+ then
+ prev_head="`cat $dotest/prev_head`"
+ end="`cat $dotest/end`"
+ msgnum="`cat $dotest/msgnum`"
+ onto="`cat $dotest/onto`"
+ continue_merge
+ while test "$msgnum" -le "$end"
+ do
+ call_merge "$msgnum"
+ continue_merge
+ done
+ finish_rb_merge
+ exit
+ fi
git am --resolved --3way --resolvemsg="$RESOLVEMSG"
exit
;;
--skip)
+ if test -d "$dotest"
+ then
+ die "--skip is not supported when using --merge"
+ fi
git am -3 --skip --resolvemsg="$RESOLVEMSG"
exit
;;
--abort)
- [ -d .dotest ] || die "No rebase in progress?"
+ if test -d "$dotest"
+ then
+ rm -r "$dotest"
+ elif test -d .dotest
+ then
+ rm -r .dotest
+ else
+ die "No rebase in progress?"
+ fi
git reset --hard ORIG_HEAD
- rm -r .dotest
exit
;;
--onto)
@@ -64,6 +179,23 @@ do
newbase="$2"
shift
;;
+ -M|-m|--m|--me|--mer|--merg|--merge)
+ do_merge=t
+ ;;
+ -s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
+ --strateg=*|--strategy=*|\
+ -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
+ case "$#,$1" in
+ *,*=*)
+ strategy=`expr "$1" : '-[^=]*=\(.*\)'` ;;
+ 1,*)
+ usage ;;
+ *)
+ strategy="$2"
+ shift ;;
+ esac
+ do_merge=t
+ ;;
-*)
usage
;;
@@ -75,16 +207,25 @@ do
done
# Make sure we do not have .dotest
-if mkdir .dotest
+if test -z "$do_merge"
then
- rmdir .dotest
-else
- echo >&2 '
+ if mkdir .dotest
+ then
+ rmdir .dotest
+ else
+ echo >&2 '
It seems that I cannot create a .dotest directory, and I wonder if you
are in the middle of patch application or another rebase. If that is not
the case, please rm -fr .dotest and run me again. I am stopping in case
you still have something valuable there.'
- exit 1
+ exit 1
+ fi
+else
+ if test -d "$dotest"
+ then
+ die "previous dotest directory $dotest still exists." \
+ 'try git-rebase < --continue | --abort >'
+ fi
fi
# The tree must be really really clean.
@@ -152,6 +293,39 @@ then
exit 0
fi
-git-format-patch -k --stdout --full-index "$upstream"..ORIG_HEAD |
-git am --binary -3 -k --resolvemsg="$RESOLVEMSG"
+if test -z "$do_merge"
+then
+ git-format-patch -k --stdout --full-index "$upstream"..ORIG_HEAD |
+ git am --binary -3 -k --resolvemsg="$RESOLVEMSG"
+ exit $?
+fi
+
+# start doing a rebase with git-merge
+# this is rename-aware if the recursive (default) strategy is used
+
+mkdir -p "$dotest"
+echo "$onto" > "$dotest/onto"
+prev_head=`git-rev-parse HEAD^0`
+echo "$prev_head" > "$dotest/prev_head"
+
+msgnum=0
+for cmt in `git-rev-list --no-merges "$upstream"..ORIG_HEAD \
+ | perl -e 'print reverse <>'`
+do
+ msgnum=$(($msgnum + 1))
+ echo "$cmt" > "$dotest/`printf "%0${prec}d" $msgnum`"
+done
+
+printf "%0${prec}d" 1 > "$dotest/msgnum"
+printf "%0${prec}d" "$msgnum" > "$dotest/end"
+
+end=$msgnum
+msgnum=1
+
+while test "$msgnum" -le "$end"
+do
+ call_merge "$msgnum"
+ continue_merge
+done
+finish_rb_merge
--
1.4.0.g65f3
^ permalink raw reply related
* [PATCH 3/3] rebase: error out for NO_PYTHON if they use recursive merge
From: Eric Wong @ 2006-06-21 10:04 UTC (permalink / raw)
To: Junio C Hamano, git; +Cc: Eric Wong
In-Reply-To: <11508842842125-git-send-email-normalperson@yhbt.net>
recursive merge relies on Python, and we can't perform
rename-aware merges without the recursive merge. So bail out
before trying it.
The test won't work w/o recursive merge, either, so skip that,
too.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
git-rebase.sh | 9 +++++++++
t/t3402-rebase-merge.sh | 6 ++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index bce7bf8..b9ce112 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -300,6 +300,15 @@ then
exit $?
fi
+if test "@@NO_PYTHON@@" && test "$strategy" = "recursive"
+then
+ die 'The recursive merge strategy currently relies on Python,
+which this installation of git was not configured with. Please consider
+a different merge strategy (e.g. octopus, resolve, stupid, ours)
+or install Python and git with Python support.'
+
+fi
+
# start doing a rebase with git-merge
# this is rename-aware if the recursive (default) strategy is used
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 8c7a519..f1c1f35 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -7,6 +7,12 @@ test_description='git rebase --merge tes
. ./test-lib.sh
+if test "$no_python"; then
+ echo "Skipping: no python => no recursive merge"
+ test_done
+ exit 0
+fi
+
T="A quick brown fox
jumps over the lazy dog."
for i in 1 2 3 4 5 6 7 8 9 10
--
1.4.0.g65f3
^ permalink raw reply related
* [PATCH (fixed)] rebase: Allow merge strategies to be used when rebasing
From: Eric Wong @ 2006-06-21 10:04 UTC (permalink / raw)
To: Junio C Hamano, git; +Cc: Eric Wong
In-Reply-To: <20060621100138.GA15748@localdomain>
1 - is fixed for --onto usage.
2 - in the series is the test from Junio, so I'm not resending it:
Subject: [PATCH] Add renaming-rebase test.
3 - keeps the NO_PYTHON people happy
--
Eric Wong
^ permalink raw reply
* Re: [PATCH] rebase: Allow merge strategies to be used when rebasing
From: Eric Wong @ 2006-06-21 10:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbqso95f3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
>
> > Junio C Hamano <junkio@cox.net> wrote:
> >
> >> - You kept the original "format-patch piped to am" workflow
> >> optionally working.
> >
> > I left it as the default, too. I figured that it's best not
> > to change the default (and most likely faster) behavior of
> > something people rely on.
>
> I should have said: "You kept ... working, which is good".
>
> >> I think the three-way merge you would want here is not between B
> >> and G using E as the pivot, but between B and G using A as the
> >> pivot. That's how cherry-pick and revert works. I would
> >> leverage the interface that is one level lower for this -- the
> >> strategy modules themselves.
> >>
> >> git-merge-$strategy $cmt^ -- HEAD $cmt
> >
> > Changing the 'git-merge $strategy_args "rebase-merge: $cmt" HEAD "$cmt"'
> > line in call_merge() to this seems to have broken more tests.
>
> Oh, that is to be expected if you changed git-merge -s recursive
> with git-merge-recursive without other changes. The former
> makes a commit (which your original patch later used to create a
> separate commit chain and discarded); the latter does not make a
> commit but expects the caller to create a commit out of the
> resulting index file.
Oops, *smacks head*
> > I'm not an expert at merging strategies by any measure, I've just
> > trusted merge-recursive to Do The Right Thing(TM) more often than not,
> > and use rerere to avoid repeating work.
>
> I was originally hoping that rebasing would just be a matter of
> listing sequence of commits to be ported onto a new base and
> running "git-cherry-pick" on each of them in sequence. Now
> cherry-pick does not use merge machinery (hence does not use
> git-merge-recursive), but if we change that then updating rebase
> would be pretty much straightforward. It just needs a UI layer
> to guide the user through recovery process when the merge does
> not resolve cleanly in the middle, no?
Sounds workable right to me. But then again, a cherry-pick is also a
case of rebase on a single commit, so we could be using rebase (and its
recovery code) in cherry-pick, too, right?
--
Eric Wong
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Josef Weidendorfer @ 2006-06-21 9:57 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <e7b2n4$hd8$1@sea.gmane.org>
On Wednesday 21 June 2006 11:15, you 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.
> Is that what you wanted, or did you want 'blame' for directories
> (trees)?
Could be interesting; but everytime I look at such a page in ViewCVS,
I want to have it sorted by time...
Josef
^ permalink raw reply
* [PATCH 2/3] Add git version to gitweb output
From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <115088195576-git-send-email-jnareb@gmail.com>
Add git-core binaries used version as the comment at the beginning of HTML
output, just below the comment with version of git web interface version.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
4434b02e9a56cf5d1939021b950bbe54240a413d
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 89224e6..87ec565 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -29,6 +29,14 @@ my $projectroot = "/home/kay/public_html
# location of the git-core binaries
my $gitbin = "/usr/bin";
+# version of the git-core binaries
+my $git_version = qx($gitbin/git --version);
+if ($git_version =~ m/git version (.*)$/) {
+ $git_version = $1;
+} else {
+ $git_version = "unknown";
+}
+
# location for temporary files needed for diffs
my $git_temp = "/tmp/gitweb";
@@ -288,11 +296,12 @@ sub git_header_html {
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
+<!-- git core binaries version $git_version -->
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="robots" content="index, nofollow"/>
-<link rel="stylesheet" type="text/css" href="$stylesheet"/>
<title>$title</title>
+<link rel="stylesheet" type="text/css" href="$stylesheet"/>
$rss_link
</head>
<body>
@@ -816,7 +825,7 @@ sub git_get_project_config {
$key =~ s/^gitweb\.//;
return if ($key =~ m/\W/);
- my $val = qx(git-repo-config --get gitweb.$key);
+ my $val = qx($gitbin/git-repo-config --get gitweb.$key);
return ($val);
}
--
1.3.0
^ permalink raw reply related
* [PATCH 1/3] gitweb: whitespace cleanup
From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <1150881954924-git-send-email-jnareb@gmail.com>
Do not use tabs to align variable initialization (actually use
tabs only at the beginning of line, for code indent). Remove trailing
whitespace. Make whitespace usage more consistent.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 38 +++++++++++++++++++-------------------
gitweb/gitweb.css | 4 ++--
2 files changed, 21 insertions(+), 21 deletions(-)
691405ab79e0dacbe3b96a404740faf3f10bffd7
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 44896bb..89224e6 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -17,33 +17,33 @@ 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 = "";
+my $version = "267";
+my $my_url = $cgi->url();
+my $my_uri = $cgi->url(-absolute => 1);
+my $rss_link = "";
# absolute fs-path which will be prepended to the project path
-#my $projectroot = "/pub/scm";
-my $projectroot = "/home/kay/public_html/pub/scm";
+#my $projectroot = "/pub/scm";
+my $projectroot = "/home/kay/public_html/pub/scm";
# location of the git-core binaries
-my $gitbin = "/usr/bin";
+my $gitbin = "/usr/bin";
# location for temporary files needed for diffs
-my $git_temp = "/tmp/gitweb";
+my $git_temp = "/tmp/gitweb";
# target of the home link on top of all pages
-my $home_link = $my_uri;
+my $home_link = $my_uri;
# html text to include at home page
-my $home_text = "indextext.html";
+my $home_text = "indextext.html";
# URI of default stylesheet
-my $stylesheet = "gitweb.css";
+my $stylesheet = "gitweb.css";
# source of projects list
-#my $projects_list = $projectroot;
-my $projects_list = "index/index.aux";
+#my $projects_list = $projectroot;
+my $projects_list = "index/index.aux";
# default blob_plain mimetype and default charset for text/plain blob
my $default_blob_plain_mimetype = 'text/plain';
@@ -51,7 +51,7 @@ my $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;
+my $mimetypes_file = undef;
# input validation and dispatch
@@ -349,7 +349,7 @@ sub git_footer_html {
sub die_error {
my $status = shift || "403 Forbidden";
- my $error = shift || "Malformed query, file missing or permission denied";
+ my $error = shift || "Malformed query, file missing or permission denied";
git_header_html($status);
print "<div class=\"page_body\">\n" .
@@ -1066,7 +1066,7 @@ sub git_summary {
"<td>";
if (length($co{'title_short'}) < length($co{'title'})) {
print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
- "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
+ "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
} else {
print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"},
"<b>" . esc_html($co{'title'}) . "$ref</b>");
@@ -1124,7 +1124,7 @@ sub git_summary {
print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
if ($tag{'reftype'} eq "commit") {
print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
}
print "</td>\n" .
"</tr>";
@@ -1362,7 +1362,7 @@ sub git_tags {
print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
if ($tag{'reftype'} eq "commit") {
print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
}
print "</td>\n" .
"</tr>";
@@ -1942,7 +1942,7 @@ sub git_commit {
"</td>" .
"</tr>\n";
}
- print "</table>".
+ print "</table>".
"</div>\n";
print "<div class=\"page_body\">\n";
my $comment = $co{'comment'};
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index ac6a3c7..98410f5 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -1,7 +1,7 @@
body {
font-family: sans-serif;
font-size: 12px;
- border:solid #d9d8d1;
+ border: solid #d9d8d1;
border-width: 1px;
margin: 10px;
background-color: #ffffff;
@@ -33,7 +33,7 @@ div.page_header a:hover {
}
div.page_nav {
- padding:8px;
+ padding: 8px;
}
div.page_nav a:visited {
--
1.3.0
^ permalink raw reply related
* [PATCH 0/3] Minor gitweb modifications and cleanups
From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw)
To: git
This series of patches is based on git.git 'next' branch
69d830d1a3a1236036bd0f84dd9794d7c8d34b3f
My future gitweb-related batches will be based on this series.
---
gitweb/gitweb.cgi | 53 +++++++++++++++++++++++++++++++----------------------
gitweb/gitweb.css | 4 ++--
2 files changed, 33 insertions(+), 24 deletions(-)
--
Jakub Narebski
ShadeHawk on #git
(git-send-email 1.4.0 with setlocale patch)
^ permalink raw reply
* [PATCH 3/3] Move $gitbin earlier in gitweb.cgi
From: Jakub Narebski @ 2006-06-21 9:25 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <1150881955505-git-send-email-jnareb@gmail.com>
(cherry picked from 9dca843086356b964f27d8fabe1e3c48074a9f02 commit)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Cherry picked commit is from feature branch in my repository:
http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi?p=git.git;a=summary
http://front.fuw.edu.pl/jnareb/scm/git.git/
gitweb/gitweb.cgi | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
f8bd1032e0d6ec88f540a820b4f5b4789562ee05
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 87ec565..ef7fcbd 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -22,13 +22,13 @@ my $my_url = $cgi->url();
my $my_uri = $cgi->url(-absolute => 1);
my $rss_link = "";
+# location of the git-core binaries
+my $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";
-# location of the git-core binaries
-my $gitbin = "/usr/bin";
-
# version of the git-core binaries
my $git_version = qx($gitbin/git --version);
if ($git_version =~ m/git version (.*)$/) {
--
1.3.0
^ permalink raw reply related
* Re: [RFC] gitweb wishlist and TODO list
From: Jakub Narebski @ 2006-06-21 9:15 UTC (permalink / raw)
To: git
In-Reply-To: <200606211056.10889.Josef.Weidendorfer@gmx.de>
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. Is that what you wanted, or did you want 'blame' for directories
(trees)?
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] send-email: Use setlocale in addition to $ENV{LC_ALL} to set locale
From: Jakub Narebski @ 2006-06-21 9:12 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <7v3bdy5178.fsf@assigned-by-dhcp.cox.net>
$ENV{LC_ALL} = 'C'; does not change locale used by strftime.
Use setlocale( LC_ALL, 'C' ); instead.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
git-send-email.perl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
7c796152570e28d3f95c17e93864c6abc8edef24
diff --git a/git-send-email.perl b/git-send-email.perl
index 7b1cca7..56949dd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -24,7 +24,8 @@ use Data::Dumper;
# most mail servers generate the Date: header, but not all...
$ENV{LC_ALL} = 'C';
-use POSIX qw/strftime/;
+use POSIX qw/strftime setlocale LC_ALL/;
+setlocale( &LC_ALL, 'C' );
my $have_email_valid = eval { require Email::Valid; 1 };
my $smtp;
--
1.3.0
^ 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