* Re: [RFD] gitweb configuration
From: Jakub Narebski @ 2006-06-18 10:05 UTC (permalink / raw)
To: git
In-Reply-To: <7v8xnu3iol.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> So I am with Timo on this one, except that in some cases munging
> gitweb.cgi script itself might be needed if the installation
> chose to hide git somewhere inaccessible from ordinary users.
^^^^^^^^^^^^^^
The problem is with webserver user (nobody, web, apache, ...),
which might have nonstandard PATH and/or be run from jail/chroot.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Junio C Hamano @ 2006-06-18 9:40 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Timo Hirvonen
In-Reply-To: <e735d7$6dq$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
> Timo Hirvonen wrote:
>
>> Just use "git command" and you don't have to know $gitexecdir.
>
> First, 'git' might be not in PATH for the webserver user which runs
> gitweb.cgi.
For that we would have a chicken-and-egg problem if we make
configuration mechanism based on git-repo-config, so I would say
per-site customization is needed somehow.
Hardcoding the path into gitweb.cgi could be one way.
Hardcoding the path to gitweb per-site configuration file and
implement the logic to parse the configuration file without
using git-repo-config would be another. Even if you wanted to
use "git --exec-path" to bootstrap, not having "git" in the path
would make it, eh, cumbersome.
My gut feeling is that it is sensible to assume git is on
everybody's path -- after all the site is running gitweb and
majority would be using binary packaged distribution, so git
would be installed somewhere sensible and accessible.
So I am with Timo on this one, except that in some cases munging
gitweb.cgi script itself might be needed if the installation
chose to hide git somewhere inaccessible from ordinary users.
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Jakub Narebski @ 2006-06-18 9:12 UTC (permalink / raw)
To: git
In-Reply-To: <20060618113052.660e1017.tihirvon@gmail.com>
Timo Hirvonen wrote:
> Jakub Narebski <jnareb@gmail.com> wrote:
>
>> - use ~/.gitconfig, /etc/gitconfig or some other global git configuration
>> file, reading values using '$gitexecdir/git-repo-config'.
>> Problem: bootstraping, namely value of $gitexecdir ($gitbin now)
>> needs to be set in gitweb.cgi, perhaps during the build process.
>
> Just use "git command" and you don't have to know $gitexecdir.
First, 'git' might be not in PATH for the webserver user which runs
gitweb.cgi.
Second, I guess that '$gitexecdir/git-repo-config' is/can be faster than
'git repo-config', but if 'git' is in the PATH we can set $gitexecdir from
'git --exec-path'.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] rebase: Allow merge strategies to be used when rebasing
From: Junio C Hamano @ 2006-06-18 9:08 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <1150599735483-git-send-email-normalperson@yhbt.net>
Eric Wong <normalperson@yhbt.net> writes:
> This solves the problem of rebasing local commits against an
> upstream that has renamed files.
I think leveraging the merge strategy to perform rebase is
sound, but the selection of merge base for this purpose is quite
different from the regular merge, and I think unfortunately this
patch is probably wrong in letting git-merge choose the merge
base.
But let's mention other things as well.
- You kept the original "format-patch piped to am" workflow
optionally working.
- You check if merge or patch was used for failed rebase and
follow the appropriate codepath while resuming, which is
good.
- The list of commits you generate with tac seem to include
merge commit -- you may want to give --no-merges to
rev-list.
- I do not think we use "tac" elsewhere -- is it portable
enough?
- Exiting with success unconditionally after "git am" feels
wrong. I would do "exit $?" instead of "exit 0" there.
Suppose you have this commit ancestry graph:
----------------------------------------------------------------
Example: git-rebase --onto master A topic
A---B---C topic B'--C' topic
/ --> /
D---E---F---G master D---E---F---G master
----------------------------------------------------------------
This is slightly different from the one at the beginning of the
script. The idea is A turned out to be not so cool, and we
would want to drop it.
> +call_merge () {
> + cmt="$(cat $dotest/`printf %0${prec}d $1`)"
> + echo "$cmt" > "$dotest/current"
> + git-merge $strategy_args "rebase-merge: $cmt" HEAD "$cmt" \
> + || die "$MRESOLVEMSG"
> +}
call_merge is first called with B in cmt, and HEAD is pointing
at G. But the merge in this function makes a merge between B
and G, taking the effect of E->A.
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
The strategy modules take merge base(s), double-dash as the
separator, our head and the other head. They do not make commit
themselves (instead they leave working tree and index in
committable state) and signal the results with their exit
status:
0 -- success
1 -- conflicts
2 -- did not handle the merge at all
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Timo Hirvonen @ 2006-06-18 8:43 UTC (permalink / raw)
To: Florian Forster; +Cc: git
In-Reply-To: <20060618082103.GA1331@verplant.org>
Florian Forster <octo@verplant.org> wrote:
> GCC ignores the FAM in this case and allocates `sizeof (struct
> combine_diff_path)' bytes. However, this is not correct according to
> ANSI and prevents building using other compilers (e.g. Sun cc).
Fair enough.
> To be honest, I don't get the point of FAMs anyways. Why don't we just
> use a pointer to `struct combine_diff_parent' there in the first place?
In general FAMs are used to replace two mallocs with one.
x = malloc(sizeof(struct foo) + 100)
instead of
x = malloc(sizeof(struct foo));
x->y = malloc(100);
--
http://onion.dynserv.net/~timo/
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Junio C Hamano @ 2006-06-18 8:38 UTC (permalink / raw)
To: Martin Langhoff; +Cc: git
In-Reply-To: <46a038f90606180042w7b4d11dbvbea28b750ddbc6e2@mail.gmail.com>
"Martin Langhoff" <martin.langhoff@gmail.com> writes:
> On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:
>> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be
>> $GIT_DIR/config or what?
>
> I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.
> Given that it works in a CGI environment, it should read
> $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).
I am not Pasky, but I think the intent of the patch is to run
"git repo-config" with GIT_CONFIG pointing at /etc/gitweb.conf
to obtain server-wide configuration (e.g. finding out where
repositories are) and then when serving individual repository
(i.e. after we set up GIT_DIR to point at it) run "git
repo-config" without GIT_CONFIG to read per-repository
configuration. That way we can reuse the configuration parser.
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Florian Forster @ 2006-06-18 8:35 UTC (permalink / raw)
To: Rene Scharfe; +Cc: git
In-Reply-To: <44950E32.10904@lsrfire.ath.cx>
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
Hi Rene,
On Sun, Jun 18, 2006 at 10:26:26AM +0200, Rene Scharfe wrote:
> However, could you split it up a bit?
Sure, I'll follow up on this in a short while..
-octo
--
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Timo Hirvonen @ 2006-06-18 8:30 UTC (permalink / raw)
To: jnareb; +Cc: git
In-Reply-To: <e731ai$su1$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> wrote:
> - use ~/.gitconfig, /etc/gitconfig or some other global git configuration
> file, reading values using '$gitexecdir/git-repo-config'.
> Problem: bootstraping, namely value of $gitexecdir ($gitbin now)
> needs to be set in gitweb.cgi, perhaps during the build process.
Just use "git command" and you don't have to know $gitexecdir.
--
http://onion.dynserv.net/~timo/
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Junio C Hamano @ 2006-06-18 8:29 UTC (permalink / raw)
To: Florian Forster; +Cc: git
In-Reply-To: <1150609831500-git-send-email-octo@verplant.org>
Florian Forster <octo@verplant.org> writes:
> While most of this patch fixes void-pointer arithmetic and is therefore
> trivial, I had to change the use of a struct with FAMs in `diff-lib.c'. Since
> this is the first time I encountered FAMs it'd probably be a good idea if
> someone who knows would take a look at that.
Thanks. I am very tempted to apply it, but I started to wonder
that in some places it might make sense to convert void* to
char* instead of casting. Undecided.
> diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
> index f6310b9..646322d 100644
> --- a/builtin-tar-tree.c
> +++ b/builtin-tar-tree.c
> @@ -34,7 +34,7 @@ static void reliable_write(void *buf, un
> die("git-tar-tree: disk full?");
> }
> size -= ret;
> - buf += ret;
> + buf = (char *) buf + ret;
Please do not add the extra whitespace to align "=".
> @@ -244,14 +244,14 @@ static void convert_date(void *buffer, u
> // "tree <sha1>\n"
> memcpy(new + newlen, buffer, 46);
> newlen += 46;
> - buffer += 46;
> + buffer = (char *) buffer + 46;
> size -= 46;
>
> // "parent <sha1>\n"
> while (!memcmp(buffer, "parent ", 7)) {
> memcpy(new + newlen, buffer, 48);
> newlen += 48;
> - buffer += 48;
> + buffer = (char *) buffer + 48;
> size -= 48;
> }
>
> @@ -275,11 +275,11 @@ static void convert_commit(void *buffer,
>
> if (memcmp(buffer, "tree ", 5))
> die("Bad commit '%s'", (char*) buffer);
> - convert_ascii_sha1(buffer+5);
> - buffer += 46; /* "tree " + "hex sha1" + "\n" */
> + convert_ascii_sha1((char *) buffer + 5);
> + buffer = (char *) buffer + 46; /* "tree " + "hex sha1" + "\n" */
> while (!memcmp(buffer, "parent ", 7)) {
> - convert_ascii_sha1(buffer+7);
> - buffer += 48;
> + convert_ascii_sha1((char *) buffer + 7);
> + buffer = (char *) buffer + 48;
> }
> convert_date(orig_buffer, orig_size, result_sha1);
> }
Hmmmmmmm. Now I start to wonder if changing the type of "void *buffer"
to "char *buffer" is cleaner.
> diff --git a/diff-delta.c b/diff-delta.c
> index 25a798d..8b9172a 100644
> --- a/diff-delta.c
> +++ b/diff-delta.c
> @@ -22,6 +22,7 @@ #include <stdlib.h>
> #include <string.h>
> #include "delta.h"
>
> +#include "git-compat-util.h"
>
> /* maximum hash entry list for the same hash bucket */
> #define HASH_LIMIT 64
> @@ -131,7 +132,7 @@ struct delta_index {
> const void *src_buf;
> unsigned long src_size;
> unsigned int hash_mask;
> - struct index_entry *hash[0];
> + struct index_entry *hash[FLEX_ARRAY];
> };
Good -- I missed this when we did FLEX_ARRAY. Thanks.
> diff --git a/diff-lib.c b/diff-lib.c
> index 2183b41..fdc1173 100644
> --- a/diff-lib.c
> +++ b/diff-lib.c
> @@ -34,21 +34,23 @@ int run_diff_files(struct rev_info *revs
> continue;
>
> if (ce_stage(ce)) {
> - struct {
> - struct combine_diff_path p;
> - struct combine_diff_parent filler[5];
> - } combine;
I admit this part was ugly. The new code does not do any extra
allocations and matches the other use of "struct combine_diff_path"
more closely. Good change.
> @@ -1136,13 +1136,14 @@ int fetch(unsigned char *sha1)
>
> static inline int needs_quote(int ch)
> {
> - switch (ch) {
> - case '/': case '-': case '.':
> - case 'A'...'Z': case 'a'...'z': case '0'...'9':
> + if (((ch >= 'A') && (ch <= 'Z'))
> + || ((ch >= 'a') && (ch <= 'z'))
> + || ((ch >= '0') && (ch <= '9'))
> + || (ch == '/')
> + || (ch == '-')
> + || (ch == '.'))
> return 0;
> - default:
> - return 1;
> - }
> + return 1;
> }
Ugh. Delight of standard compliance X-<.
> diff --git a/http-push.c b/http-push.c
> index 2d9441e..0684e46 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -1077,13 +1077,14 @@ static int fetch_indices(void)
>
> static inline int needs_quote(int ch)
Hmph. Thanks for noticing the duplicated code; maybe move it to
cache.h perhaps?
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Rene Scharfe @ 2006-06-18 8:26 UTC (permalink / raw)
To: Florian Forster; +Cc: git
In-Reply-To: <1150609831500-git-send-email-octo@verplant.org>
Florian Forster schrieb:
> Using this patch I was able to build git with
> $ make CFLAGS="-Wall -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE"
>
> While most of this patch fixes void-pointer arithmetic and is therefore
> trivial, I had to change the use of a struct with FAMs in `diff-lib.c'. Since
> this is the first time I encountered FAMs it'd probably be a good idea if
> someone who knows would take a look at that.
Nice work! However, could you split it up a bit? I.e. please send one
patch per error class/topic. A comment on why the changes are needed
would be nice too, e.g. "void pointer arithmetic is a GNU extension, get
rid of it".
Thanks,
René
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Florian Forster @ 2006-06-18 8:21 UTC (permalink / raw)
To: Timo Hirvonen; +Cc: git
In-Reply-To: <20060618110749.e6fb9030.tihirvon@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2014 bytes --]
Hi,
On Sun, Jun 18, 2006 at 11:07:49AM +0300, Timo Hirvonen wrote:
> Many of the void-pointer arithmetic warnings could be fixed by
> changing the variable types to char * instead of casting them in many
> places.
true. Casting to a void-pointer can be done implicitely (even according
to the standard), so changing a function's argument from `void *' to
`char *' might break code somewhere else.
> > - struct {
> > - struct combine_diff_path p;
> > - struct combine_diff_parent filler[5];
> > - } combine;
>
> Yes this is somewhat ugly but avoids a malloc.
No, malloc is still needed to allocate `combine.p.path'. My change does
allocate all memory in one pass, so the number of calls to malloc
doesn't differ.
> Leave the code as it is now unless it causes real problems.
`struct combine_diff_path' has a flexible array member (FAM) and is
therefore an incomplete type. This means you may not instanciate it.
GCC ignores the FAM in this case and allocates `sizeof (struct
combine_diff_path)' bytes. However, this is not correct according to
ANSI and prevents building using other compilers (e.g. Sun cc).
To be honest, I don't get the point of FAMs anyways. Why don't we just
use a pointer to `struct combine_diff_parent' there in the first place?
> 'A'...'Z' is more readable. Does some compiler fail to compile it?
It's not in ANSI, therefore GCC with `-ansi' failes, so does the Sun cc.
> > static inline int needs_quote(int ch)
>
> Hmm.. same function in http-fetch.c. Lots of common code could be
> moved to http.h.
Right, I wanted to keep the changes as minimal as possible, though.
As you can probably tell my goal is building a Solaris version of git
using the Sun cc. I'm not quite there yet and don't have time to look
into the remaining issue(s) today nor tomorrow, but I might have some
time at the end of the week.
Regards,
-octo
--
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Thomas Glanzmann @ 2006-06-18 8:14 UTC (permalink / raw)
To: Timo Hirvonen; +Cc: octo, git
In-Reply-To: <20060618110749.e6fb9030.tihirvon@gmail.com>
Hello,
> 'A'...'Z' is more readable. Does some compiler fail to compile it?
yes, it is GCC (GNU) specific IIRC. So for example the Sun Compiler will
choke on this one.
Thomas
^ permalink raw reply
* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Timo Hirvonen @ 2006-06-18 8:07 UTC (permalink / raw)
To: octo; +Cc: git
In-Reply-To: <1150609831500-git-send-email-octo@verplant.org>
Florian Forster <octo@verplant.org> wrote:
> Using this patch I was able to build git with
> $ make CFLAGS="-Wall -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE"
>
> While most of this patch fixes void-pointer arithmetic and is therefore
> trivial, I had to change the use of a struct with FAMs in `diff-lib.c'. Since
> this is the first time I encountered FAMs it'd probably be a good idea if
> someone who knows would take a look at that.
Many of the void-pointer arithmetic warnings could be fixed by changing
the variable types to char * instead of casting them in many places.
> --- a/diff-lib.c
> +++ b/diff-lib.c
> @@ -34,21 +34,23 @@ int run_diff_files(struct rev_info *revs
> continue;
>
> if (ce_stage(ce)) {
> - struct {
> - struct combine_diff_path p;
> - struct combine_diff_parent filler[5];
> - } combine;
Yes this is somewhat ugly but avoids a malloc. You could use alloca but
the man-page says:
"The alloca() function is machine and compiler dependent. On many systems
its implementation is buggy. Its use is discouraged."
Leave the code as it is now unless it causes real problems.
> static inline int needs_quote(int ch)
> {
> - switch (ch) {
> - case '/': case '-': case '.':
> - case 'A'...'Z': case 'a'...'z': case '0'...'9':
> + if (((ch >= 'A') && (ch <= 'Z'))
> + || ((ch >= 'a') && (ch <= 'z'))
> + || ((ch >= '0') && (ch <= '9'))
> + || (ch == '/')
> + || (ch == '-')
> + || (ch == '.'))
'A'...'Z' is more readable. Does some compiler fail to compile it?
> +++ b/http-push.c
> static inline int needs_quote(int ch)
Hmm.. same function in http-fetch.c. Lots of common code could be moved
to http.h.
--
http://onion.dynserv.net/~timo/
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Jakub Narebski @ 2006-06-18 8:02 UTC (permalink / raw)
To: git
In-Reply-To: <46a038f90606180042w7b4d11dbvbea28b750ddbc6e2@mail.gmail.com>
Martin Langhoff wrote:
> On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:
>> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be
>> $GIT_DIR/config or what?
>
> I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.
> Given that it works in a CGI environment, it should read
> $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).
When talking about gitweb [installation] configuration, including where to
find GIT projects to display, one needs to remember that gitweb might (and
probably is) installed from binary package and not git.git, and
git/.git/config might not exist.
So we have the following options to separate gitweb-wide options:
- use ~/.gitconfig, /etc/gitconfig or some other global git configuration
file, reading values using '$gitexecdir/git-repo-config'.
Problem: bootstraping, namely value of $gitexecdir ($gitbin now)
needs to be set in gitweb.cgi, perhaps during the build process.
- use gitweb.conf for configuration, reading values via equivalent of
'GIT_CONFIG=gitweb.conf $gitexecdir/git-repo-config'.
Problem: bootstraping, namely value of $gitexecdir ($gitbin now)
needs to be set in gitweb.cgi, perhaps during the build process.
- use gitweb.conf for configuration, following the .git/config format,
writing parsing of ini file (reading only) in Perl from scratch
(or use one of many CPAN modules).
- use Perl for configuration file, a la Jon Loeliger <jdl@jdl.com> patch:
http://marc.theaimsgroup.com/?l=git&m=114308224922372&w=2
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFD] gitweb configuration
From: Martin Langhoff @ 2006-06-18 7:42 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <e72j53$1m1$1@sea.gmane.org>
On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:
> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be
> $GIT_DIR/config or what?
I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.
Given that it works in a CGI environment, it should read
$GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).
cheers,
martin
^ permalink raw reply
* [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Florian Forster @ 2006-06-18 5:50 UTC (permalink / raw)
To: git; +Cc: Florian Forster
Using this patch I was able to build git with
$ make CFLAGS="-Wall -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE"
While most of this patch fixes void-pointer arithmetic and is therefore
trivial, I had to change the use of a struct with FAMs in `diff-lib.c'. Since
this is the first time I encountered FAMs it'd probably be a good idea if
someone who knows would take a look at that.
Signed-off-by: Florian Forster <octo@verplant.org>
---
blame.c | 4 ++--
builtin-apply.c | 6 +++---
builtin-read-tree.c | 3 +--
builtin-tar-tree.c | 6 +++---
convert-objects.c | 22 +++++++++++-----------
csum-file.c | 4 ++--
diff-delta.c | 5 +++--
diff-lib.c | 41 ++++++++++++++++++++++-------------------
diff.c | 2 +-
diffcore-order.c | 2 +-
http-fetch.c | 15 ++++++++-------
http-push.c | 15 ++++++++-------
http.c | 4 ++--
imap-send.c | 2 +-
pack-check.c | 6 +++---
pack-objects.c | 4 ++--
pack-redundant.c | 16 ++++++++--------
patch-delta.c | 4 ++--
pkt-line.c | 4 ++--
quote.c | 9 ++++++++-
read-cache.c | 13 +++++++------
sha1_file.c | 27 ++++++++++++++-------------
ssh-fetch.c | 2 +-
tag.c | 4 ++--
tree-walk.c | 11 ++++++-----
25 files changed, 123 insertions(+), 108 deletions(-)
714b7eca861ad3b6863209f0298d55c0c2292116
diff --git a/blame.c b/blame.c
index 25d3bcf..51eab2e 100644
--- a/blame.c
+++ b/blame.c
@@ -301,9 +301,9 @@ static void fill_line_map(struct commit
if (DEBUG)
printf("map: i1: %d %d %p i2: %d %d %p\n",
i1, map[i1],
- i1 != -1 ? blame_lines[map[i1]] : NULL,
+ (void *) (i1 != -1 ? blame_lines[map[i1]] : NULL),
i2, map2[i2],
- i2 != -1 ? blame_lines[map2[i2]] : NULL);
+ (void *) (i2 != -1 ? blame_lines[map2[i2]] : NULL));
if (map2[i2] != -1 &&
blame_lines[map[i1]] &&
!blame_lines[map2[i2]])
diff --git a/builtin-apply.c b/builtin-apply.c
index e113c74..6dd0472 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -148,7 +148,7 @@ static void *read_patch_file(int fd, uns
buffer = xrealloc(buffer, alloc);
nr = alloc - size;
}
- nr = xread(fd, buffer + size, nr);
+ nr = xread(fd, (char *) buffer + size, nr);
if (!nr)
break;
if (nr < 0)
@@ -164,7 +164,7 @@ static void *read_patch_file(int fd, uns
*/
if (alloc < size + SLOP)
buffer = xrealloc(buffer, size + SLOP);
- memset(buffer + size, 0, SLOP);
+ memset((char *) buffer + size, 0, SLOP);
return buffer;
}
@@ -1194,7 +1194,7 @@ static int read_old_data(struct stat *st
return error("unable to open %s", path);
got = 0;
for (;;) {
- int ret = xread(fd, buf + got, size - got);
+ int ret = xread(fd, (char *) buf + got, size - got);
if (ret <= 0)
break;
got += ret;
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index bb50fbd..fdd6706 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -30,8 +30,7 @@ static int merge_size = 0;
static struct object_list *trees = NULL;
-static struct cache_entry df_conflict_entry = {
-};
+static struct cache_entry df_conflict_entry;
struct tree_entry_list {
struct tree_entry_list *next;
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index f6310b9..646322d 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -34,7 +34,7 @@ static void reliable_write(void *buf, un
die("git-tar-tree: disk full?");
}
size -= ret;
- buf += ret;
+ buf = (char *) buf + ret;
}
}
@@ -87,13 +87,13 @@ static void write_blocked(void *buf, uns
memcpy(block + offset, buf, chunk);
size -= chunk;
offset += chunk;
- buf += chunk;
+ buf = (char *) buf + chunk;
write_if_needed();
}
while (size >= BLOCKSIZE) {
reliable_write(buf, BLOCKSIZE);
size -= BLOCKSIZE;
- buf += BLOCKSIZE;
+ buf = (char *) buf + BLOCKSIZE;
}
if (size) {
memcpy(block + offset, buf, size);
diff --git a/convert-objects.c b/convert-objects.c
index a67d6b4..0fabd89 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -103,12 +103,12 @@ static int write_subdirectory(void *buff
if (!slash) {
newlen += sprintf(new + newlen, "%o %s", mode, path);
new[newlen++] = '\0';
- memcpy(new + newlen, buffer + len - 20, 20);
+ memcpy(new + newlen, (char *) buffer + len - 20, 20);
newlen += 20;
used += len;
size -= len;
- buffer += len;
+ buffer = (char *) buffer + len;
continue;
}
@@ -121,7 +121,7 @@ static int write_subdirectory(void *buff
used += len;
size -= len;
- buffer += len;
+ buffer = (char *) buffer + len;
}
write_sha1_file(new, newlen, tree_type, result_sha1);
@@ -137,13 +137,13 @@ static void convert_tree(void *buffer, u
while (size) {
int len = 1+strlen(buffer);
- convert_binary_sha1(buffer + len);
+ convert_binary_sha1((char *) buffer + len);
len += 20;
if (len > size)
die("corrupt tree object");
size -= len;
- buffer += len;
+ buffer = (char *) buffer + len;
}
write_subdirectory(orig_buffer, orig_size, "", 0, result_sha1);
@@ -244,14 +244,14 @@ static void convert_date(void *buffer, u
// "tree <sha1>\n"
memcpy(new + newlen, buffer, 46);
newlen += 46;
- buffer += 46;
+ buffer = (char *) buffer + 46;
size -= 46;
// "parent <sha1>\n"
while (!memcmp(buffer, "parent ", 7)) {
memcpy(new + newlen, buffer, 48);
newlen += 48;
- buffer += 48;
+ buffer = (char *) buffer + 48;
size -= 48;
}
@@ -275,11 +275,11 @@ static void convert_commit(void *buffer,
if (memcmp(buffer, "tree ", 5))
die("Bad commit '%s'", (char*) buffer);
- convert_ascii_sha1(buffer+5);
- buffer += 46; /* "tree " + "hex sha1" + "\n" */
+ convert_ascii_sha1((char *) buffer + 5);
+ buffer = (char *) buffer + 46; /* "tree " + "hex sha1" + "\n" */
while (!memcmp(buffer, "parent ", 7)) {
- convert_ascii_sha1(buffer+7);
- buffer += 48;
+ convert_ascii_sha1((char *) buffer + 7);
+ buffer = (char *) buffer + 48;
}
convert_date(orig_buffer, orig_size, result_sha1);
}
diff --git a/csum-file.c b/csum-file.c
index 5f9249a..ebaad03 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -17,7 +17,7 @@ static int sha1flush(struct sha1file *f,
for (;;) {
int ret = xwrite(f->fd, buf, count);
if (ret > 0) {
- buf += ret;
+ buf = (char *) buf + ret;
count -= ret;
if (count)
continue;
@@ -57,7 +57,7 @@ int sha1write(struct sha1file *f, void *
memcpy(f->buffer + offset, buf, nr);
count -= nr;
offset += nr;
- buf += nr;
+ buf = (char *) buf + nr;
left -= nr;
if (!left) {
SHA1_Update(&f->ctx, f->buffer, offset);
diff --git a/diff-delta.c b/diff-delta.c
index 25a798d..8b9172a 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -22,6 +22,7 @@ #include <stdlib.h>
#include <string.h>
#include "delta.h"
+#include "git-compat-util.h"
/* maximum hash entry list for the same hash bucket */
#define HASH_LIMIT 64
@@ -131,7 +132,7 @@ struct delta_index {
const void *src_buf;
unsigned long src_size;
unsigned int hash_mask;
- struct index_entry *hash[0];
+ struct index_entry *hash[FLEX_ARRAY];
};
struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
@@ -283,7 +284,7 @@ create_delta(const struct delta_index *i
ref_data = index->src_buf;
ref_top = ref_data + index->src_size;
data = trg_buf;
- top = trg_buf + trg_size;
+ top = (const unsigned char *) trg_buf + trg_size;
outpos++;
val = 0;
diff --git a/diff-lib.c b/diff-lib.c
index 2183b41..fdc1173 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -34,21 +34,23 @@ int run_diff_files(struct rev_info *revs
continue;
if (ce_stage(ce)) {
- struct {
- struct combine_diff_path p;
- struct combine_diff_parent filler[5];
- } combine;
+ struct combine_diff_path *dpath;
int num_compare_stages = 0;
+ size_t path_len;
- combine.p.next = NULL;
- combine.p.len = ce_namelen(ce);
- combine.p.path = xmalloc(combine.p.len + 1);
- memcpy(combine.p.path, ce->name, combine.p.len);
- combine.p.path[combine.p.len] = 0;
- combine.p.mode = 0;
- memset(combine.p.sha1, 0, 20);
- memset(&combine.p.parent[0], 0,
- sizeof(combine.filler));
+ path_len = ce_namelen(ce);
+
+ dpath = xmalloc (combine_diff_path_size (5, path_len));
+ dpath->path = (char *) &(dpath->parent[5]);
+
+ dpath->next = NULL;
+ dpath->len = path_len;
+ memcpy(dpath->path, ce->name, path_len);
+ dpath->path[path_len] = '\0';
+ dpath->mode = 0;
+ memset(dpath->sha1, 0, 20);
+ memset(&(dpath->parent[0]), 0,
+ sizeof(struct combine_diff_parent)*5);
while (i < entries) {
struct cache_entry *nce = active_cache[i];
@@ -64,11 +66,11 @@ int run_diff_files(struct rev_info *revs
if (2 <= stage) {
int mode = ntohl(nce->ce_mode);
num_compare_stages++;
- memcpy(combine.p.parent[stage-2].sha1,
+ memcpy(dpath->parent[stage-2].sha1,
nce->sha1, 20);
- combine.p.parent[stage-2].mode =
+ dpath->parent[stage-2].mode =
canon_mode(mode);
- combine.p.parent[stage-2].status =
+ dpath->parent[stage-2].status =
DIFF_STATUS_MODIFIED;
}
@@ -83,13 +85,14 @@ int run_diff_files(struct rev_info *revs
i--;
if (revs->combine_merges && num_compare_stages == 2) {
- show_combined_diff(&combine.p, 2,
+ show_combined_diff(dpath, 2,
revs->dense_combined_merges,
revs);
- free(combine.p.path);
+ free(dpath);
continue;
}
- free(combine.p.path);
+ free(dpath);
+ dpath = NULL;
/*
* Show the diff for the 'ce' if we found the one
diff --git a/diff.c b/diff.c
index 9e9cfc8..fb1411c 100644
--- a/diff.c
+++ b/diff.c
@@ -515,7 +515,7 @@ static void emit_binary_diff(mmfile_t *o
else
line[0] = bytes - 26 + 'a' - 1;
encode_85(line + 1, cp, bytes);
- cp += bytes;
+ cp = (char *) cp + bytes;
puts(line);
}
printf("\n");
diff --git a/diffcore-order.c b/diffcore-order.c
index 0bc2b22..aef6da6 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -30,7 +30,7 @@ static void prepare_order(const char *or
close(fd);
if (map == MAP_FAILED)
return;
- endp = map + st.st_size;
+ endp = (char *) map + st.st_size;
for (pass = 0; pass < 2; pass++) {
cnt = 0;
cp = map;
diff --git a/http-fetch.c b/http-fetch.c
index da1a7f5..2b63d89 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -123,7 +123,7 @@ static size_t fwrite_sha1_file(void *ptr
struct object_request *obj_req = (struct object_request *)data;
do {
ssize_t retval = write(obj_req->local,
- ptr + posn, size - posn);
+ (char *) ptr + posn, size - posn);
if (retval < 0)
return posn;
posn += retval;
@@ -1136,13 +1136,14 @@ int fetch(unsigned char *sha1)
static inline int needs_quote(int ch)
{
- switch (ch) {
- case '/': case '-': case '.':
- case 'A'...'Z': case 'a'...'z': case '0'...'9':
+ if (((ch >= 'A') && (ch <= 'Z'))
+ || ((ch >= 'a') && (ch <= 'z'))
+ || ((ch >= '0') && (ch <= '9'))
+ || (ch == '/')
+ || (ch == '-')
+ || (ch == '.'))
return 0;
- default:
- return 1;
- }
+ return 1;
}
static inline int hex(int v)
diff --git a/http-push.c b/http-push.c
index 2d9441e..0684e46 100644
--- a/http-push.c
+++ b/http-push.c
@@ -196,7 +196,7 @@ static size_t fwrite_sha1_file(void *ptr
struct transfer_request *request = (struct transfer_request *)data;
do {
ssize_t retval = write(request->local_fileno,
- ptr + posn, size - posn);
+ (char *) ptr + posn, size - posn);
if (retval < 0)
return posn;
posn += retval;
@@ -1077,13 +1077,14 @@ static int fetch_indices(void)
static inline int needs_quote(int ch)
{
- switch (ch) {
- case '/': case '-': case '.':
- case 'A'...'Z': case 'a'...'z': case '0'...'9':
+ if (((ch >= 'A') && (ch <= 'Z'))
+ || ((ch >= 'a') && (ch <= 'z'))
+ || ((ch >= '0') && (ch <= '9'))
+ || (ch == '/')
+ || (ch == '-')
+ || (ch == '.'))
return 0;
- default:
- return 1;
- }
+ return 1;
}
static inline int hex(int v)
diff --git a/http.c b/http.c
index 08769cc..6c1937b 100644
--- a/http.c
+++ b/http.c
@@ -34,7 +34,7 @@ size_t fread_buffer(void *ptr, size_t el
size_t size = eltsize * nmemb;
if (size > buffer->size - buffer->posn)
size = buffer->size - buffer->posn;
- memcpy(ptr, buffer->buffer + buffer->posn, size);
+ memcpy(ptr, (char *) buffer->buffer + buffer->posn, size);
buffer->posn += size;
return size;
}
@@ -49,7 +49,7 @@ size_t fwrite_buffer(const void *ptr, si
buffer->size = buffer->posn + size;
buffer->buffer = xrealloc(buffer->buffer, buffer->size);
}
- memcpy(buffer->buffer + buffer->posn, ptr, size);
+ memcpy((char *) buffer->buffer + buffer->posn, ptr, size);
buffer->posn += size;
data_received++;
return size;
diff --git a/imap-send.c b/imap-send.c
index 285ad29..87db8e2 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -93,7 +93,7 @@ typedef struct {
char *data;
int len;
unsigned char flags;
- unsigned char crlf:1;
+ unsigned int crlf:1;
} msg_data_t;
#define DRV_OK 0
diff --git a/pack-check.c b/pack-check.c
index e575879..3a62e1b 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -29,10 +29,10 @@ static int verify_packfile(struct packed
pack_base = p->pack_base;
SHA1_Update(&ctx, pack_base, pack_size - 20);
SHA1_Final(sha1, &ctx);
- if (memcmp(sha1, pack_base + pack_size - 20, 20))
+ if (memcmp(sha1, (char *) pack_base + pack_size - 20, 20))
return error("Packfile %s SHA1 mismatch with itself",
p->pack_name);
- if (memcmp(sha1, index_base + index_size - 40, 20))
+ if (memcmp(sha1, (char *) index_base + index_size - 40, 20))
return error("Packfile %s SHA1 mismatch with idx",
p->pack_name);
@@ -135,7 +135,7 @@ int verify_pack(struct packed_git *p, in
SHA1_Init(&ctx);
SHA1_Update(&ctx, index_base, index_size - 20);
SHA1_Final(sha1, &ctx);
- if (memcmp(sha1, index_base + index_size - 20, 20))
+ if (memcmp(sha1, (char *) index_base + index_size - 20, 20))
ret = error("Packfile index for %s SHA1 mismatch",
p->pack_name);
diff --git a/pack-objects.c b/pack-objects.c
index 179560f..ba6525d 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -156,7 +156,7 @@ static void prepare_pack_revindex(struct
rix->revindex = xmalloc(sizeof(unsigned long) * (num_ent + 1));
for (i = 0; i < num_ent; i++) {
- unsigned int hl = *((unsigned int *)(index + 24 * i));
+ unsigned int hl = *((unsigned int *)((char *) index + 24*i));
rix->revindex[i] = ntohl(hl);
}
/* This knows the pack format -- the 20-byte trailer
@@ -300,7 +300,7 @@ static unsigned long write_object(struct
use_packed_git(p);
datalen = find_packed_object_size(p, entry->in_pack_offset);
- buf = p->pack_base + entry->in_pack_offset;
+ buf = (char *) p->pack_base + entry->in_pack_offset;
sha1write(f, buf, datalen);
unuse_packed_git(p);
hdrlen = 0; /* not really */
diff --git a/pack-redundant.c b/pack-redundant.c
index cd81f5a..4864a2b 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -246,12 +246,12 @@ static struct pack_list * pack_list_diff
static void cmp_two_packs(struct pack_list *p1, struct pack_list *p2)
{
int p1_off, p2_off;
- void *p1_base, *p2_base;
+ unsigned char *p1_base, *p2_base;
struct llist_item *p1_hint = NULL, *p2_hint = NULL;
p1_off = p2_off = 256 * 4 + 4;
- p1_base = (void *)p1->pack->index_base;
- p2_base = (void *)p2->pack->index_base;
+ p1_base = (unsigned char *) p1->pack->index_base;
+ p2_base = (unsigned char *) p2->pack->index_base;
while (p1_off <= p1->pack->index_size - 3 * 20 &&
p2_off <= p2->pack->index_size - 3 * 20)
@@ -351,11 +351,11 @@ static size_t sizeof_union(struct packed
{
size_t ret = 0;
int p1_off, p2_off;
- void *p1_base, *p2_base;
+ char *p1_base, *p2_base;
p1_off = p2_off = 256 * 4 + 4;
- p1_base = (void *)p1->index_base;
- p2_base = (void *)p2->index_base;
+ p1_base = (char *)p1->index_base;
+ p2_base = (char *)p2->index_base;
while (p1_off <= p1->index_size - 3 * 20 &&
p2_off <= p2->index_size - 3 * 20)
@@ -534,7 +534,7 @@ static struct pack_list * add_pack(struc
{
struct pack_list l;
size_t off;
- void *base;
+ unsigned char *base;
if (!p->pack_local && !(alt_odb || verbose))
return NULL;
@@ -543,7 +543,7 @@ static struct pack_list * add_pack(struc
llist_init(&l.all_objects);
off = 256 * 4 + 4;
- base = (void *)p->index_base;
+ base = (unsigned char *)p->index_base;
while (off <= p->index_size - 3 * 20) {
llist_insert_back(l.all_objects, base + off);
off += 24;
diff --git a/patch-delta.c b/patch-delta.c
index 8f318ed..e3a1d42 100644
--- a/patch-delta.c
+++ b/patch-delta.c
@@ -25,7 +25,7 @@ void *patch_delta(const void *src_buf, u
return NULL;
data = delta_buf;
- top = delta_buf + delta_size;
+ top = (const unsigned char *) delta_buf + delta_size;
/* make sure the orig file size matches what we expect */
size = get_delta_hdr_size(&data, top);
@@ -56,7 +56,7 @@ void *patch_delta(const void *src_buf, u
cp_off + cp_size > src_size ||
cp_size > size)
goto bad;
- memcpy(out, src_buf + cp_off, cp_size);
+ memcpy(out, (char *) src_buf + cp_off, cp_size);
out += cp_size;
size -= cp_size;
} else if (cmd) {
diff --git a/pkt-line.c b/pkt-line.c
index bb3bab0..44d4296 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -21,7 +21,7 @@ static void safe_write(int fd, const voi
while (n) {
int ret = xwrite(fd, buf, n);
if (ret > 0) {
- buf += ret;
+ buf = (char *) buf + ret;
n -= ret;
continue;
}
@@ -66,7 +66,7 @@ static void safe_read(int fd, void *buff
int n = 0;
while (n < size) {
- int ret = xread(fd, buffer + n, size - n);
+ int ret = xread(fd, (char *) buffer + n, size - n);
if (ret < 0)
die("read error (%s)", strerror(errno));
if (!ret)
diff --git a/quote.c b/quote.c
index 06792d4..dcc2326 100644
--- a/quote.c
+++ b/quote.c
@@ -206,7 +206,14 @@ #define EMIT(c) (outp ? (*outp++ = (c))
case '\\': case '"':
break; /* verbatim */
- case '0'...'7':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
/* octal */
ac = ((ch - '0') << 6);
if ((ch = *sp++) < '0' || '7' < ch)
diff --git a/read-cache.c b/read-cache.c
index c499c51..3c32aae 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -706,7 +706,7 @@ static int verify_hdr(struct cache_heade
SHA1_Init(&c);
SHA1_Update(&c, hdr, size - 20);
SHA1_Final(sha1, &c);
- if (memcmp(sha1, (void *)hdr + size - 20, 20))
+ if (memcmp(sha1, (char *) hdr + size - 20, 20))
return error("bad index file sha1 signature");
return 0;
}
@@ -770,7 +770,7 @@ int read_cache(void)
offset = sizeof(*hdr);
for (i = 0; i < active_nr; i++) {
- struct cache_entry *ce = map + offset;
+ struct cache_entry *ce = (struct cache_entry *) ((char *) map + offset);
offset = offset + ce_size(ce);
active_cache[i] = ce;
}
@@ -783,10 +783,11 @@ int read_cache(void)
* in 4-byte network byte order.
*/
unsigned long extsize;
- memcpy(&extsize, map + offset + 4, 4);
+ memcpy(&extsize, (char *) map + offset + 4, 4);
extsize = ntohl(extsize);
- if (read_index_extension(map + offset,
- map + offset + 8, extsize) < 0)
+ if (read_index_extension(((const char *) map) + offset,
+ (char *) map + offset + 8,
+ extsize) < 0)
goto unmap;
offset += 8;
offset += extsize;
@@ -820,7 +821,7 @@ static int ce_write(SHA_CTX *context, in
}
write_buffer_len = buffered;
len -= partial;
- data += partial;
+ data = (char *) data + partial;
}
return 0;
}
diff --git a/sha1_file.c b/sha1_file.c
index b4ff233..3c001d7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -486,7 +486,8 @@ int use_packed_git(struct packed_git *p)
* this is cheap.
*/
if (memcmp((char*)(p->index_base) + p->index_size - 40,
- p->pack_base + p->pack_size - 20, 20)) {
+ (char *) p->pack_base + p->pack_size - 20,
+ 20)) {
die("packfile %s does not match index.", p->pack_name);
}
@@ -701,7 +702,7 @@ static void *unpack_sha1_rest(z_stream *
int bytes = strlen(buffer) + 1;
unsigned char *buf = xmalloc(1+size);
- memcpy(buf, buffer + bytes, stream->total_out - bytes);
+ memcpy(buf, (char *) buffer + bytes, stream->total_out - bytes);
bytes = stream->total_out - bytes;
if (bytes < size) {
stream->next_out = buf + bytes;
@@ -853,7 +854,7 @@ static unsigned long unpack_object_heade
if (offset >= p->pack_size)
die("object offset outside of pack file");
- pack = p->pack_base + offset;
+ pack = (unsigned char *) p->pack_base + offset;
c = *pack++;
offset++;
*type = (c >> 4) & 7;
@@ -883,7 +884,7 @@ int check_reuse_pack_delta(struct packed
ptr = unpack_object_header(p, ptr, kindp, sizep);
if (*kindp != OBJ_DELTA)
goto done;
- memcpy(base, p->pack_base + ptr, 20);
+ memcpy(base, (char *) p->pack_base + ptr, 20);
status = 0;
done:
unuse_packed_git(p);
@@ -903,7 +904,7 @@ void packed_object_info_detail(struct pa
enum object_type kind;
offset = unpack_object_header(p, e->offset, &kind, size);
- pack = p->pack_base + offset;
+ pack = (unsigned char *) p->pack_base + offset;
if (kind != OBJ_DELTA)
*delta_chain_length = 0;
else {
@@ -919,7 +920,7 @@ void packed_object_info_detail(struct pa
find_pack_entry_one(pack, &base_ent, p);
offset = unpack_object_header(p, base_ent.offset,
&kind, &junk);
- pack = p->pack_base + offset;
+ pack = (unsigned char *) p->pack_base + offset;
chain_length++;
} while (kind == OBJ_DELTA);
*delta_chain_length = chain_length;
@@ -957,7 +958,7 @@ static int packed_object_info(struct pac
die("cannot map packed file");
offset = unpack_object_header(p, entry->offset, &kind, &size);
- pack = p->pack_base + offset;
+ pack = (unsigned char *) p->pack_base + offset;
left = p->pack_size - offset;
switch (kind) {
@@ -1096,7 +1097,7 @@ void *unpack_entry_gently(struct pack_en
void *retval;
offset = unpack_object_header(p, entry->offset, &kind, &size);
- pack = p->pack_base + offset;
+ pack = (unsigned char *) p->pack_base + offset;
left = p->pack_size - offset;
switch (kind) {
case OBJ_DELTA:
@@ -1134,7 +1135,7 @@ int nth_packed_object_sha1(const struct
void *index = p->index_base + 256;
if (n < 0 || num_packed_objects(p) <= n)
return -1;
- memcpy(sha1, (index + 24 * n + 4), 20);
+ memcpy(sha1, (char *) index + (24 * n) + 4, 20);
return 0;
}
@@ -1148,9 +1149,9 @@ int find_pack_entry_one(const unsigned c
do {
int mi = (lo + hi) / 2;
- int cmp = memcmp(index + 24 * mi + 4, sha1, 20);
+ int cmp = memcmp((char *) index + (24 * mi) + 4, sha1, 20);
if (!cmp) {
- e->offset = ntohl(*((unsigned int *)(index + 24 * mi)));
+ e->offset = ntohl(*((unsigned int *) ((char *) index + (24 * mi))));
memcpy(e->sha1, sha1, 20);
e->p = p;
return 1;
@@ -1290,7 +1291,7 @@ void *read_object_with_reference(const u
ref_length = strlen(ref_type);
if (memcmp(buffer, ref_type, ref_length) ||
- get_sha1_hex(buffer + ref_length, actual_sha1)) {
+ get_sha1_hex((char *) buffer + ref_length, actual_sha1)) {
free(buffer);
return NULL;
}
@@ -1408,7 +1409,7 @@ static int write_buffer(int fd, const vo
return error("file write error (%s)", strerror(errno));
}
len -= size;
- buf += size;
+ buf = (char *) buf + size;
}
return 0;
}
diff --git a/ssh-fetch.c b/ssh-fetch.c
index e3067b8..1e59cd2 100644
--- a/ssh-fetch.c
+++ b/ssh-fetch.c
@@ -24,7 +24,7 @@ static ssize_t force_write(int fd, void
{
ssize_t ret = 0;
while (ret < length) {
- ssize_t size = write(fd, buffer + ret, length - ret);
+ ssize_t size = write(fd, (char *) buffer + ret, length - ret);
if (size < 0) {
return size;
}
diff --git a/tag.c b/tag.c
index f390ee7..13c364d 100644
--- a/tag.c
+++ b/tag.c
@@ -47,10 +47,10 @@ int parse_tag_buffer(struct tag *item, v
if (size < 64)
return -1;
- if (memcmp("object ", data, 7) || get_sha1_hex(data + 7, object))
+ if (memcmp("object ", data, 7) || get_sha1_hex((char *) data + 7, object))
return -1;
- type_line = data + 48;
+ type_line = (char *) data + 48;
if (memcmp("\ntype ", type_line-1, 6))
return -1;
diff --git a/tree-walk.c b/tree-walk.c
index 297c697..3f83e98 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -43,7 +43,7 @@ void update_tree_entry(struct tree_desc
if (size < len)
die("corrupt tree file");
- desc->buf = buf + len;
+ desc->buf = (char *) buf + len;
desc->size = size - len;
}
@@ -66,7 +66,7 @@ const unsigned char *tree_entry_extract(
const void *tree = desc->buf;
unsigned long size = desc->size;
int len = strlen(tree)+1;
- const unsigned char *sha1 = tree + len;
+ const unsigned char *sha1 = (unsigned char *) tree + len;
const char *path;
unsigned int mode;
@@ -80,7 +80,8 @@ const unsigned char *tree_entry_extract(
int tree_entry(struct tree_desc *desc, struct name_entry *entry)
{
- const void *tree = desc->buf, *path;
+ const void *tree = desc->buf;
+ const char *path;
unsigned long len, size = desc->size;
if (!size)
@@ -95,10 +96,10 @@ int tree_entry(struct tree_desc *desc, s
entry->pathlen = len;
path += len + 1;
- entry->sha1 = path;
+ entry->sha1 = (const unsigned char *) path;
path += 20;
- len = path - tree;
+ len = path - (char *) tree;
if (len > size)
die("corrupt tree file");
--
1.3.3
^ permalink raw reply related
* parsecvs leaks and optimizations
From: Jon Smirl @ 2006-06-18 5:15 UTC (permalink / raw)
To: Keith Packard, git
#1) the seen field is wrapping, char is too small.
#2)
static void
rev_tag_search (rev_ref **tags, int ntag, rev_ref *tag, rev_list *rl)
{
rev_commit **commits = calloc (ntag, sizeof (rev_commit *));
int n;
for (n = 0; n < ntag; n++)
commits[n] = tags[n]->commit;
ntag = rev_commit_date_sort (commits, ntag);
tag->parent = rev_branch_of_commit (rl, commits[0]);
if (tag->parent)
tag->commit = rev_commit_locate (tag->parent, commits[0]);
if (!tag->commit) {
tag->commit = rev_commit_build (commits, ntag);
>>> everything from here is leaking
}
free (commits);
}
#3) cvs_find_symbol is very hot, probably should be a hash. Mozilla
has thousands of symbols.
#4) rcs2git is n-squared and parses the file over and over to get the
revs. The n-squared really hurts when a ,v file is 45MB. A single pass
algorithm would work wonders. Or at least cache the offsets to the
revs as they are found. Can the revs be written straight to a pack
file and then connected up with a tree later?
#5) This small group fails, parsecvs sends a null to git. Git dies.
/home/mozcvs/mozilla/Makefile.in,v
/home/mozcvs/mozilla/.cvsignore,v
/home/mozcvs/mozilla/LEGAL,v
/home/mozcvs/mozilla/LICENSE,v
/home/mozcvs/mozilla/README.txt,v
/home/mozcvs/mozilla/aclocal.m4,v
/home/mozcvs/mozilla/camino.mk,v
#6) comparing versions is very hot. Could versions be encoded into a
long or long long for more efficient comparisons? Packed bit field
unioned with long. Checks on initial parsing to make sure fields don't
over flow.
I'm working on some global analysis to try and track down the missing
branch tags but it is very slow going. It would be better to speed up
the basic process first.
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: [PATCH] Move gitweb style to gitweb.css
From: Jakub Narebski @ 2006-06-18 4:32 UTC (permalink / raw)
To: git
In-Reply-To: <7vhd2j5hi2.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Move gitweb style from embedded <style> element in gitweb/gitweb.cgi
>> to external CSS file gitweb/gitweb.css.
>>
>> ---
>> External CSS file can be downloaded only once and cached.
>
> That's good, but I'm wondering if you dropped this deliberately
> or it was just an accident.
>
>> -body {
>> - font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px;
>> - margin:10px; background-color:#ffffff; color:#000000;
>> -}
Ooops. Amended commit follows.
Note: this patch is of temporary use, as I plan to merge xmms2 additions
to gitweb, which include separate CSS file too.
-- >8 --
From nobody Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sat Jun 17 11:15:18 2006 +0200
Subject: [PATCH] Move gitweb style to gitweb.css
Move gitweb style from embedded <style> element in gitweb/gitweb.cgi
to external CSS file gitweb/gitweb.css. Introduced new configuration
variable $stylesheet.
---
gitweb/gitweb.cgi | 64 +++--------------------------------------------------
gitweb/gitweb.css | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 60 deletions(-)
create mode 100644 gitweb/gitweb.css
42b89d8cbc6bdfed33df7bdadf45a3254cf8f1ae
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index ea21fbe..9d902b7 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -38,6 +38,9 @@ my $home_link = $my_uri;
# html text to include at home page
my $home_text = "indextext.html";
+# URI of default stylesheet
+my $stylesheet = "gitweb.css";
+
# source of projects list
#my $projects_list = $projectroot;
my $projects_list = "index/index.aux";
@@ -257,68 +260,9 @@ sub git_header_html {
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="robots" content="index, nofollow"/>
+<link rel="stylesheet" href="$stylesheet"/>
<title>$title</title>
$rss_link
-<style type="text/css">
-body {
- font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px;
- margin:10px; background-color:#ffffff; color:#000000;
-}
-a { color:#0000cc; }
-a:hover, a:visited, a:active { color:#880000; }
-div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
-div.page_header a:visited, a.header { color:#0000cc; }
-div.page_header a:hover { color:#880000; }
-div.page_nav { padding:8px; }
-div.page_nav a:visited { color:#0000cc; }
-div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
-div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; }
-div.page_footer_text { float:left; color:#555555; font-style:italic; }
-div.page_body { padding:8px; }
-div.title, a.title {
- display:block; padding:6px 8px;
- font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
-}
-a.title:hover { background-color: #d9d8d1; }
-div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
-div.log_body { padding:8px 8px 8px 150px; }
-span.age { position:relative; float:left; width:142px; font-style:italic; }
-div.log_link {
- padding:0px 8px;
- font-size:10px; font-family:sans-serif; font-style:normal;
- position:relative; float:left; width:136px;
-}
-div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
-a.list { text-decoration:none; color:#000000; }
-a.list:hover { text-decoration:underline; color:#880000; }
-a.text { text-decoration:none; color:#0000cc; }
-a.text:visited { text-decoration:none; color:#880000; }
-a.text:hover { text-decoration:underline; color:#880000; }
-table { padding:8px 4px; }
-th { padding:2px 5px; font-size:12px; text-align:left; }
-tr.light:hover { background-color:#edece6; }
-tr.dark { background-color:#f6f6f0; }
-tr.dark:hover { background-color:#edece6; }
-td { padding:2px 5px; font-size:12px; vertical-align:top; }
-td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
-div.pre { font-family:monospace; font-size:12px; white-space:pre; }
-div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
-div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
-div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
-a.linenr { color:#999999; text-decoration:none }
-a.rss_logo {
- float:right; padding:3px 0px; width:35px; line-height:10px;
- border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
- color:#ffffff; background-color:#ff6600;
- font-weight:bold; font-family:sans-serif; font-size:10px;
- text-align:center; text-decoration:none;
-}
-a.rss_logo:hover { background-color:#ee5500; }
-span.tag {
- padding:0px 4px; font-size:10px; font-weight:normal;
- background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc;
-}
-</style>
</head>
<body>
EOF
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
new file mode 100644
index 0000000..5900916
--- /dev/null
+++ b/gitweb/gitweb.css
@@ -0,0 +1,58 @@
+body {
+ font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px;
+ margin:10px; background-color:#ffffff; color:#000000;
+}
+a { color:#0000cc; }
+a:hover, a:visited, a:active { color:#880000; }
+div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
+div.page_header a:visited, a.header { color:#0000cc; }
+div.page_header a:hover { color:#880000; }
+div.page_nav { padding:8px; }
+div.page_nav a:visited { color:#0000cc; }
+div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
+div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; }
+div.page_footer_text { float:left; color:#555555; font-style:italic; }
+div.page_body { padding:8px; }
+div.title, a.title {
+ display:block; padding:6px 8px;
+ font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
+}
+a.title:hover { background-color: #d9d8d1; }
+div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
+div.log_body { padding:8px 8px 8px 150px; }
+span.age { position:relative; float:left; width:142px; font-style:italic; }
+div.log_link {
+ padding:0px 8px;
+ font-size:10px; font-family:sans-serif; font-style:normal;
+ position:relative; float:left; width:136px;
+}
+div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
+a.list { text-decoration:none; color:#000000; }
+a.list:hover { text-decoration:underline; color:#880000; }
+a.text { text-decoration:none; color:#0000cc; }
+a.text:visited { text-decoration:none; color:#880000; }
+a.text:hover { text-decoration:underline; color:#880000; }
+table { padding:8px 4px; }
+th { padding:2px 5px; font-size:12px; text-align:left; }
+tr.light:hover { background-color:#edece6; }
+tr.dark { background-color:#f6f6f0; }
+tr.dark:hover { background-color:#edece6; }
+td { padding:2px 5px; font-size:12px; vertical-align:top; }
+td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
+div.pre { font-family:monospace; font-size:12px; white-space:pre; }
+div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
+div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
+div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
+a.linenr { color:#999999; text-decoration:none }
+a.rss_logo {
+ float:right; padding:3px 0px; width:35px; line-height:10px;
+ border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
+ color:#ffffff; background-color:#ff6600;
+ font-weight:bold; font-family:sans-serif; font-size:10px;
+ text-align:center; text-decoration:none;
+}
+a.rss_logo:hover { background-color:#ee5500; }
+span.tag {
+ padding:0px 4px; font-size:10px; font-weight:normal;
+ background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc;
+}
--
1.3.0
^ permalink raw reply related
* Re: [RFD] gitweb configuration
From: Jakub Narebski @ 2006-06-18 4:00 UTC (permalink / raw)
To: git
In-Reply-To: <20060617232358.GK2609@pasky.or.cz>
Petr Baudis wrote:
>> - gitweb installation options (gitweb version need not to correspond to
>> git version, and we could theoretically have more than one gitweb
>> installation while one git-core installation). It was proposed to put
>> such options on gitweb.conf file in the same directory as gitweb.cgi.
>> Unfortunately if one would want to use git-repo-config for managing
>> gitweb.conf one is out of luck: git-repo-config uses $GIT_DIR/config.
>
> In the longer term, perhaps this kind of configuration might land in the
> global git configuration file.
We could use user's "global" configuration file, ~/.gitconfig, in patch
from Johannes Schindelin (and now in 'pu').
So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be
$GIT_DIR/config or what?
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] rebase: Allow merge strategies to be used when rebasing
From: Eric Wong @ 2006-06-18 3:02 UTC (permalink / raw)
To: git, Junio C Hamano; +Cc: Eric Wong
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 | 176 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 186 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..68bddfb 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -34,7 +34,81 @@ 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_args=
+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
+
+ mh="$GIT_DIR/MERGE_HEAD"
+ mm="$GIT_DIR/MERGE_MSG"
+ if test -f "$mh" && test -f "$mm"
+ then
+ git-commit -F "$mm" || die "commit failed: $MRESOLVEMSG"
+ 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_args "rebase-merge: $cmt" HEAD "$cmt" \
+ || die "$MRESOLVEMSG"
+}
+
+finish_rb_merge () {
+ set -e
+
+ msgnum=1
+ echo "Finalizing rebased commits..."
+ git-reset --hard "`cat $dotest/upstream`"
+ 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 +120,42 @@ do
exit 1
;;
esac
+ if test -d "$dotest"
+ then
+ prev_head="`cat $dotest/prev_head`"
+ end="`cat $dotest/end`"
+ msgnum="`cat $dotest/msgnum`"
+ 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 +163,24 @@ 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
+ strategy_args="${strategy_args}-s $strategy "
+ ;;
-*)
usage
;;
@@ -75,16 +192,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 +278,38 @@ 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 0
+fi
+
+# start doing a rebase with git-merge
+# this is rename-aware if the recursive (default) strategy is used
+
+mkdir -p "$dotest"
+echo "$upstream" > "$dotest/upstream"
+prev_head=`git-rev-parse HEAD^0`
+echo "$prev_head" > "$dotest/prev_head"
+
+msgnum=0
+for cmt in `git-rev-list "$upstream"..ORIG_HEAD | tac`
+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.ge24c
^ permalink raw reply related
* Re: [PATCH] Move gitweb style to gitweb.css
From: Junio C Hamano @ 2006-06-18 2:23 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <200606171123.56643.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> Move gitweb style from embedded <style> element in gitweb/gitweb.cgi
> to external CSS file gitweb/gitweb.css.
>
> ---
> External CSS file can be downloaded only once and cached.
That's good, but I'm wondering if you dropped this deliberately
or it was just an accident.
> -body {
> - font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px;
> - margin:10px; background-color:#ffffff; color:#000000;
> -}
^ permalink raw reply
* Some more memory leak avoidance
From: Linus Torvalds @ 2006-06-18 1:47 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
This is really the dregs of my effort to not waste memory in git-rev-list,
and makes barely one percent of a difference in the memory footprint, but
hey, it's also a pretty small patch.
It discards the parent lists and the commit buffer after the commit has
been shown by git-rev-list (and "git log" - which already did the commit
buffer part), and frees the commit list entry that was used by the
revision walker.
The big win would be to get rid of the "refs" pointer in the object
structure (another 5%), because it's only used by fsck. That would require
some pretty major surgery to fsck, though, so I'm timid and did the less
interesting but much easier part instead.
This (percentually) makes a bigger difference to "git log" and friends,
since those are walking _just_ commits, and thus the list entries tend to
be a bigger percentage of the memory use. But the "list all objects" case
does improve too.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
This one should be independent of the other memory use optimizations.
builtin-log.c | 2 ++
builtin-rev-list.c | 8 ++++++++
revision.c | 6 ++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 29a8851..f6da1c3 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -40,6 +40,8 @@ static int cmd_log_wc(int argc, const ch
log_tree_commit(rev, commit);
free(commit->buffer);
commit->buffer = NULL;
+ free_commit_list(commit->parents);
+ commit->parents = NULL;
}
return 0;
}
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 2b298c4..71353eb 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -89,6 +89,14 @@ static void show_commit(struct commit *c
printf("%s%c", pretty_header, hdr_termination);
}
fflush(stdout);
+ if (commit->parents) {
+ free_commit_list(commit->parents);
+ commit->parents = NULL;
+ }
+ if (commit->buffer) {
+ free(commit->buffer);
+ commit->buffer = NULL;
+ }
}
static struct object_list **process_blob(struct blob *blob,
diff --git a/revision.c b/revision.c
index f4b8826..475d604 100644
--- a/revision.c
+++ b/revision.c
@@ -944,9 +944,11 @@ struct commit *get_revision(struct rev_i
}
do {
- struct commit *commit = revs->commits->item;
+ struct commit_list *entry = revs->commits;
+ struct commit *commit = entry->item;
- revs->commits = revs->commits->next;
+ revs->commits = entry->next;
+ free(entry);
/*
* If we haven't done the list limiting, we need to look at
^ permalink raw reply related
* Move "void *util" from "struct object" into "struct commit"
From: Linus Torvalds @ 2006-06-18 1:26 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
Every single user actually wanted this only for commit objects, and we
have no reason to waste space on it for other object types. So just move
the structure member from the low-level "struct object" into the "struct
commit".
This leaves the commit object the same size, and removes one unnecessary
pointer from all other object allocations.
This shrinks memory usage (still at a fairly hefty half-gig, admittedly)
of "git-rev-list --all --objects" on the mozilla repo by another 5% in my
tests.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
This is on top of the previous memory usage shrinking patch, and won't
actually work without it (although if wanted, you can start off with this
one with some trivial modifications - they are _barely_ interdependent,
with very little overlap)
blame.c | 48 ++++++++++++++++++++++++------------------------
builtin-show-branch.c | 24 ++++++++++++------------
commit.c | 4 ++--
commit.h | 1 +
name-rev.c | 12 +++++++++---
object.h | 1 -
6 files changed, 48 insertions(+), 42 deletions(-)
diff --git a/blame.c b/blame.c
index 88bfec2..2dd70ee 100644
--- a/blame.c
+++ b/blame.c
@@ -108,8 +108,8 @@ static struct patch *get_patch(struct co
xdemitconf_t xecfg;
mmfile_t file_c, file_o;
xdemitcb_t ecb;
- struct util_info *info_c = (struct util_info *)commit->object.util;
- struct util_info *info_o = (struct util_info *)other->object.util;
+ struct util_info *info_c = (struct util_info *)commit->util;
+ struct util_info *info_o = (struct util_info *)other->util;
struct timeval tv_start, tv_end;
get_blob(commit);
@@ -195,7 +195,7 @@ static int get_blob_sha1_internal(const
static void get_blob(struct commit *commit)
{
- struct util_info *info = commit->object.util;
+ struct util_info *info = commit->util;
char type[20];
if (info->buf)
@@ -221,8 +221,8 @@ #if DEBUG
/* For debugging only */
static void print_map(struct commit *cmit, struct commit *other)
{
- struct util_info *util = cmit->object.util;
- struct util_info *util2 = other->object.util;
+ struct util_info *util = cmit->util;
+ struct util_info *util2 = other->util;
int i;
int max =
@@ -257,8 +257,8 @@ #endif
static void fill_line_map(struct commit *commit, struct commit *other,
struct patch *p)
{
- struct util_info *util = commit->object.util;
- struct util_info *util2 = other->object.util;
+ struct util_info *util = commit->util;
+ struct util_info *util2 = other->util;
int *map = util->line_map;
int *map2 = util2->line_map;
int cur_chunk = 0;
@@ -320,14 +320,14 @@ static void fill_line_map(struct commit
static int map_line(struct commit *commit, int line)
{
- struct util_info *info = commit->object.util;
+ struct util_info *info = commit->util;
assert(line >= 0 && line < info->num_lines);
return info->line_map[line];
}
static struct util_info* get_util(struct commit *commit)
{
- struct util_info *util = commit->object.util;
+ struct util_info *util = commit->util;
if (util)
return util;
@@ -338,13 +338,13 @@ static struct util_info* get_util(struct
util->line_map = NULL;
util->num_lines = -1;
util->pathname = NULL;
- commit->object.util = util;
+ commit->util = util;
return util;
}
static int fill_util_info(struct commit *commit)
{
- struct util_info *util = commit->object.util;
+ struct util_info *util = commit->util;
assert(util);
assert(util->pathname);
@@ -357,7 +357,7 @@ static int fill_util_info(struct commit
static void alloc_line_map(struct commit *commit)
{
- struct util_info *util = commit->object.util;
+ struct util_info *util = commit->util;
int i;
if (util->line_map)
@@ -381,7 +381,7 @@ static void alloc_line_map(struct commit
static void init_first_commit(struct commit* commit, const char* filename)
{
- struct util_info* util = commit->object.util;
+ struct util_info* util = commit->util;
int i;
util->pathname = filename;
@@ -390,7 +390,7 @@ static void init_first_commit(struct com
alloc_line_map(commit);
- util = commit->object.util;
+ util = commit->util;
for (i = 0; i < util->num_lines; i++)
util->line_map[i] = i;
@@ -411,7 +411,7 @@ static void process_commits(struct rev_i
assert(commit);
init_first_commit(commit, path);
- util = commit->object.util;
+ util = commit->util;
num_blame_lines = util->num_lines;
blame_lines = xmalloc(sizeof(struct commit *) * num_blame_lines);
blame_contents = util->buf;
@@ -450,7 +450,7 @@ static void process_commits(struct rev_i
continue;
alloc_line_map(commit);
- util = commit->object.util;
+ util = commit->util;
for (parents = commit->parents;
parents != NULL; parents = parents->next) {
@@ -510,7 +510,7 @@ static int compare_tree_path(struct rev_
{
int ret;
const char* paths[2];
- struct util_info* util = c2->object.util;
+ struct util_info* util = c2->util;
paths[0] = util->pathname;
paths[1] = NULL;
@@ -539,7 +539,7 @@ static int same_tree_as_empty_path(struc
static const char* find_rename(struct commit* commit, struct commit* parent)
{
- struct util_info* cutil = commit->object.util;
+ struct util_info* cutil = commit->util;
struct diff_options diff_opts;
const char *paths[1];
int i;
@@ -583,7 +583,7 @@ static void simplify_commit(struct rev_i
return;
if (!commit->parents) {
- struct util_info* util = commit->object.util;
+ struct util_info* util = commit->util;
if (!same_tree_as_empty_path(revs, commit->tree,
util->pathname))
commit->object.flags |= TREECHANGE;
@@ -610,7 +610,7 @@ static void simplify_commit(struct rev_i
case REV_TREE_NEW:
{
- struct util_info* util = commit->object.util;
+ struct util_info* util = commit->util;
if (revs->remove_empty_trees &&
same_tree_as_empty_path(revs, p->tree,
util->pathname)) {
@@ -701,13 +701,13 @@ static const char* format_time(unsigned
static void topo_setter(struct commit* c, void* data)
{
- struct util_info* util = c->object.util;
+ struct util_info* util = c->util;
util->topo_data = data;
}
static void* topo_getter(struct commit* c)
{
- struct util_info* util = c->object.util;
+ struct util_info* util = c->util;
return util->topo_data;
}
@@ -850,7 +850,7 @@ int main(int argc, const char **argv)
struct util_info* u;
if (!c)
c = initial;
- u = c->object.util;
+ u = c->util;
if (!found_rename && strcmp(filename, u->pathname))
found_rename = 1;
@@ -868,7 +868,7 @@ int main(int argc, const char **argv)
if (!c)
c = initial;
- u = c->object.util;
+ u = c->util;
get_commit_info(c, &ci);
fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
if(compability) {
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index cf9c071..09d8227 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -51,9 +51,9 @@ struct commit_name {
static void name_commit(struct commit *commit, const char *head_name, int nth)
{
struct commit_name *name;
- if (!commit->object.util)
- commit->object.util = xmalloc(sizeof(struct commit_name));
- name = commit->object.util;
+ if (!commit->util)
+ commit->util = xmalloc(sizeof(struct commit_name));
+ name = commit->util;
name->head_name = head_name;
name->generation = nth;
}
@@ -65,8 +65,8 @@ static void name_commit(struct commit *c
*/
static void name_parent(struct commit *commit, struct commit *parent)
{
- struct commit_name *commit_name = commit->object.util;
- struct commit_name *parent_name = parent->object.util;
+ struct commit_name *commit_name = commit->util;
+ struct commit_name *parent_name = parent->util;
if (!commit_name)
return;
if (!parent_name ||
@@ -80,12 +80,12 @@ static int name_first_parent_chain(struc
int i = 0;
while (c) {
struct commit *p;
- if (!c->object.util)
+ if (!c->util)
break;
if (!c->parents)
break;
p = c->parents->item;
- if (!p->object.util) {
+ if (!p->util) {
name_parent(c, p);
i++;
}
@@ -106,7 +106,7 @@ static void name_commits(struct commit_l
/* First give names to the given heads */
for (cl = list; cl; cl = cl->next) {
c = cl->item;
- if (c->object.util)
+ if (c->util)
continue;
for (i = 0; i < num_rev; i++) {
if (rev[i] == c) {
@@ -132,9 +132,9 @@ static void name_commits(struct commit_l
struct commit_name *n;
int nth;
c = cl->item;
- if (!c->object.util)
+ if (!c->util)
continue;
- n = c->object.util;
+ n = c->util;
parents = c->parents;
nth = 0;
while (parents) {
@@ -142,7 +142,7 @@ static void name_commits(struct commit_l
char newname[1000], *en;
parents = parents->next;
nth++;
- if (p->object.util)
+ if (p->util)
continue;
en = newname;
switch (n->generation) {
@@ -257,7 +257,7 @@ static void join_revs(struct commit_list
static void show_one_commit(struct commit *commit, int no_name)
{
char pretty[256], *cp;
- struct commit_name *name = commit->object.util;
+ struct commit_name *name = commit->util;
if (commit->object.parsed)
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
pretty, sizeof(pretty), 0, NULL, NULL);
diff --git a/commit.c b/commit.c
index 11fca55..5914200 100644
--- a/commit.c
+++ b/commit.c
@@ -711,12 +711,12 @@ int count_parents(struct commit * commit
void topo_sort_default_setter(struct commit *c, void *data)
{
- c->object.util = data;
+ c->util = data;
}
void *topo_sort_default_getter(struct commit *c)
{
- return c->object.util;
+ return c->util;
}
/*
diff --git a/commit.h b/commit.h
index c9de167..7c9ca3f 100644
--- a/commit.h
+++ b/commit.h
@@ -11,6 +11,7 @@ struct commit_list {
struct commit {
struct object object;
+ void *util;
unsigned long date;
struct commit_list *parents;
struct tree *tree;
diff --git a/name-rev.c b/name-rev.c
index 1f0135f..c29b93e 100644
--- a/name-rev.c
+++ b/name-rev.c
@@ -19,7 +19,7 @@ static void name_rev(struct commit *comm
const char *tip_name, int merge_traversals, int generation,
int deref)
{
- struct rev_name *name = (struct rev_name *)commit->object.util;
+ struct rev_name *name = (struct rev_name *)commit->util;
struct commit_list *parents;
int parent_number = 1;
@@ -41,7 +41,7 @@ static void name_rev(struct commit *comm
if (name == NULL) {
name = xmalloc(sizeof(rev_name));
- commit->object.util = name;
+ commit->util = name;
goto copy_data;
} else if (name->merge_traversals > merge_traversals ||
(name->merge_traversals == merge_traversals &&
@@ -108,7 +108,13 @@ static int name_ref(const char *path, co
static const char* get_rev_name(struct object *o)
{
static char buffer[1024];
- struct rev_name *n = (struct rev_name *)o->util;
+ struct rev_name *n;
+ struct commit *c;
+
+ if (o->type != TYPE_COMMIT)
+ return "undefined";
+ c = (struct commit *) o;
+ n = c->util;
if (!n)
return "undefined";
diff --git a/object.h b/object.h
index a0762b6..f4ee2e5 100644
--- a/object.h
+++ b/object.h
@@ -29,7 +29,6 @@ struct object {
unsigned flags : FLAG_BITS;
unsigned char sha1[20];
struct object_refs *refs;
- void *util;
};
extern int track_object_refs;
^ permalink raw reply related
* What's in git.git
From: Junio C Hamano @ 2006-06-18 0:48 UTC (permalink / raw)
To: git; +Cc: vger
It's been a while since I've done v1.4.0, and I haven't fully
caught up with the list traffic yet, but here is the current
status.
I'm planning to manage the v1.4.X series a bit differently
during this round. So far, they were supposed to be fix-only on
top of v1.4.0, but people who follow the maintenance series
(including the binary packages) missed out on too many good
stuff that happen on the "master" branch. Also presses like
lwn.net tended to cover the maint series which gets stale pretty
quickly.
So I'll first merge only post-1.4.0 fixes and additions to the
"master" branch until we are comfortable with its shape, tag it
as 1.4.1, and continue. Essentially, "next" and "pu" will
become the playpens (the first being "not proven but fixable"
changes, the latter being "under consideration, but will not be
missed if dropped" changes) their names originally implied, and
"master" will be what "maint" was supposed to be -- fixes and
good changes. The old fixes-only maintenance on "maint" branch
will be halted for now -- except maybe when some urgent fixes
are needed, I might do 1.4.X.Y like the kernel folks do.
* The 'master' branch has these since v1.4.0
Dennis Stosberg:
Make t4101-apply-nonl bring along its patches
Eric W. Biederman:
Don't parse any headers in the real body of an email message.
Eric Wong:
git-svn: t0000: add -f flag to checkout
git-svn: fix handling of filenames with embedded '@'
git-svn: eol_cp corner-case fixes
git-svn: restore original LC_ALL setting (or unset) for commit
git-svn: don't allow commit if svn tree is not current
git-svn: support -C<num> passing to git-diff-tree
git-svn: --branch-all-refs / -B support
git-svn: optimize --branch and --branch-all-ref
git-svn: support manually placed initial trees from fetch
git-svn: Move all git-svn-related paths into $GIT_DIR/svn
git-svn: minor cleanups, extra error-checking
git-svn: add --repack and --repack-flags= options
git-svn: add --shared and --template= options to pass to init-db
git-svn: add some functionality to better support branches in svn
git-svn: add UTF-8 message test
git-svn: add 'log' command, a facsimile of basic `svn log'
git-svn: add support for Perl SVN::* libraries
git-svn: make the $GIT_DIR/svn/*/revs directory obsolete
git-svn: avoid creating some small files
git-svn: fix several small bugs, enable branch optimization
git-svn: Eliminate temp file usage in libsvn_get_file()
git-svn: bugfix and optimize the 'log' command
git-svn: tests no longer fail if LC_ALL is not a UTF-8 locale
git-svn: svn (command-line) 1.0.x compatibility
git-svn: rebuild convenience and bugfixes
Florian Forster:
gitweb: Adding a `blame' interface.
gitweb: Make the `blame' interface in gitweb optional.
Fredrik Kuivinen:
blame: Add --time to produce raw timestamps
Jakub Narebski:
Update gitweb README: gitweb is now included with git
Junio C Hamano:
gitk: rereadrefs needs listrefs
fix git alias
t5100: mailinfo and mailsplit tests.
mailinfo: ignore blanks after in-body headers.
Linus Torvalds:
gitweb.cgi history not shown
Martin Langhoff:
cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
cvsimport: complete the cvsps run before starting the import
cvsimport: keep one index per branch during import
Peter Eriksen:
Implement safe_strncpy() as strlcpy() and use it more.
Sean Estabrooks:
Add a "--notags" option for git-p4import.
Sven Verdoolaege:
git-cvsexportcommit.perl: fix typo
* The 'next' branch, in addition, has these.
Johannes Schindelin:
diff options: add --color
I would say this would be fine as is -- diff being quite
important part of the system, I just wanted to cook it for a
while.
Junio C Hamano:
read-tree: --prefix=<path>/ option.
write-tree: --prefix=<path>
read-tree: reorganize bind_merge code.
I'll have them graduate to "master" soon, as they do not seem
to hurt anybody.
fetch-pack: give up after getting too many "ack continue"
Maybe merge to "master" and see what it breaks.
shared repository: optionally allow reading to "others".
This should be ready. I just want to do another round of
check.
Paul Eggert:
date.c: improve guess between timezone offset and year.
This is more for the entertainment value than for practical
value ;-).
* The 'pu' branch, in addition, has these.
Johannes Schindelin:
Read configuration also from ~/.gitconfig
repo-config: learn the flag "--no-local"
I see Pasky has proposed another config change (this time,
not "also from" but "alternatively from") -- I am not sure
which one is more appropriate. Waiting for Johannes's
response to Pasky's message and hoping the list can agree on
a single patch series to apply to "next".
Teach diff about -b and -w flags
Yakov Lerner:
auto-detect changed prefix and/or changed build flags
I think this is fine, except that test-prefix-change target
is probably unneeded as Martin noticed.
^ permalink raw reply
* [ANNOUNCE] Cogito-0.17.3
From: Petr Baudis @ 2006-06-18 0:19 UTC (permalink / raw)
To: git; +Cc: linux-kernel
Hello,
cogito-0.17.3 was just released - bugfixes release on the latest
stable line of the Cogito user-friendly Git user interface.
Plenty of new stuff, mostly bugfixes - especially cg-admin-rewritehist
was particularily bug-ridden and Git 1.4.0 broke some backwards
compatibility, Cogito 0.17.3 should work smoothly with it again.
So, what's new?
* Many cg-admin-rewritehist bugfixes; note that -r semantics was
changed to match documentation, -k steps in to mean what -r used
to in practice
* Some documentation fixes
* Adjust to some Git 1.4.0 usage changes and new-style git-http-push
* Several other random things
Who did what:
Bertrand Jacquin:
Push over HTTP now works with refs/heads/foo instead of foo
Dennis Stosberg:
cg-clean fails on files beginning with a dash
Johannes Sixt:
cg-admin-rewritehist: Seed the commit map with the parents specified with -r
Enhance the rewritemap seeding when given symbolic commit ids
cg-admin-rewritehist: fix reappearing files with --filter-tree
cg-admin-rewritehist: Add the documented but missing --msg-filter option.
cg-admin-rewritehist: Must use the parent of the start rev to seed the map.
cg-admin-rewritehist: Support multiple parents of the start revision (-r).
cg-admin-rewritehist: Support partial rewriting of complicated history.
Jonas Fonseca:
ciabot: fix post-update hook description
Portfile: bring it up to date; use description from cogito.spec.in
Minor doc fixes
Fix section slicing so help options are not misplaced in cg-commit(1)
Martin Langhoff:
cg-status -- disambiguate parameters to git-diff-files
Pavel Roskin:
Fix cg-status with recent git versions
[PATCH 1/2] Fix cg-patch hanging on terminals with TOSTOP flag
[PATCH 2/2] Improve the tutorial script
Petr Baudis:
mkdir -p .git/info since git-init-db won't always create it
Separate git-diff-* file arguments by --
Export the $PATH we've set
Use local Cogito version when running the tutorial script
Fix cg-rm -r in a subdirectory
Do not export relpath - fixes cg-add -r in a subdir
Fix output of cg-status path with path given w/o trailing slash
cg-status: do not strip subdirs given in path specifier
Make cg-rm -r subdir fix actually safe
Fix broken tree timewarp with late git versions
Use tail -n +2 inst. of tail +2
Make testcases take input from /dev/null
Fix cg-tag calls changed by the backported update
Fix cg-admin-rewritehist -r
Indentation fix
cg-admin-rewritehist: Die in case of invalid revisions
cogito-0.17.3
Yann Dirson:
[PATCH 2/2] Catch history inconsistency in cg-admin-rewritehist
Fix cg-object-id to lookup parents in the Right Way
[PATCH 1/3] cg-admin-rewritehist: catch git-rev-list returning no commit
P.S.: See us at #git @ FreeNode!
Happy hacking,
--
Petr "Pasky the lousy poet" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe. -- Douglas Adams
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox