* [PATCH] Must not modify the_index.cache as it may be passed to realloc at some point.
From: Keith Packard @ 2007-10-03 5:44 UTC (permalink / raw)
To: Git Mailing List; +Cc: keithp
[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]
The index cache is not static, growing as new entries are added. If entries
are added after prune_cache is called, cache will no longer point at the
base of the allocation, and realloc will not be happy.
I verified that this was the only place in the current source which modified
any index_state.cache elements aside from the alloc/realloc calls in read-cache by
changing the type of the element to 'struct cache_entry ** const cache' and
recompiling.
A more efficient patch would create a separate 'cache_base' value to track
the allocation and then fix things up when reallocation was necessary,
instead of the brute-force memmove used here.
---
builtin-ls-files.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index 6c1db86..0028b8a 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -280,7 +280,7 @@ static void prune_cache(const char *prefix)
if (pos < 0)
pos = -pos-1;
- active_cache += pos;
+ memmove (active_cache, active_cache + pos, (active_nr - pos) * sizeof (struct cache_entry *));
active_nr -= pos;
first = 0;
last = active_nr;
--
1.5.3.3.131.g34c6d-dirty
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related
* Re: Clone corruption to G4 MacOSX
From: Junio C Hamano @ 2007-10-03 5:44 UTC (permalink / raw)
To: Perry Wagle; +Cc: git
In-Reply-To: <82638874-6766-4DCD-BF5B-3893F9B5046F@cs.indiana.edu>
Perry Wagle <wagle@cs.indiana.edu> writes:
> include/linux/netfilter/xt_CONNMARK.h. The involved files seem to be:
>
> include/linux/netfilter/xt_CONNMARK.h
> include/linux/netfilter/xt_DSCP.h
> include/linux/netfilter/xt_MARK.h
> include/linux/netfilter/xt_TCPMSS.h
> include/linux/netfilter_ipv4/ipt_CONNMARK.h
> include/linux/netfilter_ipv4/ipt_DSCP.h
> include/linux/netfilter_ipv4/ipt_ECN.h
> include/linux/netfilter_ipv4/ipt_MARK.h
> include/linux/netfilter_ipv4/ipt_TCPMSS.h
> include/linux/netfilter_ipv4/ipt_TOS.h
> include/linux/netfilter_ipv4/ipt_TTL.h
> include/linux/netfilter_ipv6/ip6t_HL.h
> include/linux/netfilter_ipv6/ip6t_MARK.h
> net/ipv4/netfilter/ipt_ECN.c
> net/ipv4/netfilter/ipt_TOS.c
> net/ipv4/netfilter/ipt_TTL.c
> net/ipv6/netfilter/ip6t_HL.c
> net/netfilter/xt_CONNMARK.c
> net/netfilter/xt_DSCP.c
> net/netfilter/xt_MARK.c
> net/netfilter/xt_TCPMSS.c
>
> I first noticed this corruption around August 14, 2007, when it seemed
> ...
>
> If I clone Linus's repository to a x86 machine, I get no corruption.
>
> My wild ass guess is that being big-endian is causing trouble.
Is the filesystem HFS+ that is case-losing?
^ permalink raw reply
* Re: git push (mis ?)behavior
From: Junio C Hamano @ 2007-10-03 5:39 UTC (permalink / raw)
To: Miles Bader; +Cc: Pierre Habouzit, git
In-Reply-To: <buoprzwn5qm.fsf@dhapc248.dev.necel.com>
Miles Bader <miles.bader@necel.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>> I think it is sensible to have an option to make it push only the
>> current branch. I am not sure if it is sensible to make that the
>> default.
>
> I really like the current default, it matches my mental model well: I
> generally use "push" to mean "synchronize the remote repository with my
> current one"; if multiple branches have changed, I want those changes
> propagated too.
>
> I think changing it would be a bad idea, it just seems a pointlessly
> incompatible change. The reasons I've seen offered on this thread for
> changing the default seem pretty weak, e.g., "it's more conservative"
> (but more annoying), and "it's more like SVK" (who cares?).
Usually we hear people complain louder on the list.
People who are happy with the existing behaviour tend to be
quiet, and we should be really careful not to break things for
silent majority.
I try to stay fairly conservative, often more conservative than
what I would like to be myself, for this exact reason.
^ permalink raw reply
* [PATCH] rebase: make the warning more useful when the work tree is unclean.
From: Junio C Hamano @ 2007-10-03 5:30 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git, Steffen Prohaska
In-Reply-To: <7vd4vxmmxr.fsf@gitster.siamese.dyndns.org>
Instead of letting "update-index --refresh" report paths needing
updates and merges, use git-status to give more useful output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* I won't be a good judge of the updated behaviour, as I never
start rebase in an unclear tree. Running git-status in a
large tree may be too expensive to be worth changing the
output.
git-rebase.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 1583402..93e3b3c 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -254,7 +254,11 @@ else
fi
# The tree must be really really clean.
-git update-index --refresh || exit
+git update-index -q --refresh || {
+ git status
+ printf "cannot rebase: the work tree is not clean.\n"
+ exit 1
+}
diff=$(git diff-index --cached --name-status -r HEAD)
case "$diff" in
?*) echo "cannot rebase: your index is not up-to-date"
--
1.5.3.3.1144.gf10f2
^ permalink raw reply related
* Re: Clone corruption to G4 MacOSX
From: Kyle McMartin @ 2007-10-03 5:28 UTC (permalink / raw)
To: Perry Wagle; +Cc: git
In-Reply-To: <82638874-6766-4DCD-BF5B-3893F9B5046F@cs.indiana.edu>
On Tue, Oct 02, 2007 at 09:29:07PM -0700, Perry Wagle wrote:
> If I clone Linus's repository to a x86 machine, I get no corruption.
>
> My wild ass guess is that being big-endian is causing trouble.
>
The problem is MacOSX uses a case-insensitive filesystem by default...
Cheers,
Kyle
^ permalink raw reply
* Clone corruption to G4 MacOSX
From: Perry Wagle @ 2007-10-03 4:29 UTC (permalink / raw)
To: git
I have a G4 iBook running MacOSX 10.4.10. If I build the most recent
production git (git-1.5.3.2) from the tarball from the git website, I
get a corrupt copy of Linus's kernel repository (git://git.kernel.org/
pub/scm/linux/kernel/git/torvalds/linux-2.6.git) when I try to clone
it. Specifically, my copy is missing several files, including ./
include/linux/netfilter/xt_CONNMARK.h. The involved files seem to be:
include/linux/netfilter/xt_CONNMARK.h
include/linux/netfilter/xt_DSCP.h
include/linux/netfilter/xt_MARK.h
include/linux/netfilter/xt_TCPMSS.h
include/linux/netfilter_ipv4/ipt_CONNMARK.h
include/linux/netfilter_ipv4/ipt_DSCP.h
include/linux/netfilter_ipv4/ipt_ECN.h
include/linux/netfilter_ipv4/ipt_MARK.h
include/linux/netfilter_ipv4/ipt_TCPMSS.h
include/linux/netfilter_ipv4/ipt_TOS.h
include/linux/netfilter_ipv4/ipt_TTL.h
include/linux/netfilter_ipv6/ip6t_HL.h
include/linux/netfilter_ipv6/ip6t_MARK.h
net/ipv4/netfilter/ipt_ECN.c
net/ipv4/netfilter/ipt_TOS.c
net/ipv4/netfilter/ipt_TTL.c
net/ipv6/netfilter/ip6t_HL.c
net/netfilter/xt_CONNMARK.c
net/netfilter/xt_DSCP.c
net/netfilter/xt_MARK.c
net/netfilter/xt_TCPMSS.c
I first noticed this corruption around August 14, 2007, when it
seemed to be in the head of the clone of Linus's repository. I was
able to make it go away by committing the HEAD. I was just starting
with git, and figured I got some incomplete copy because Linus was in
the middle of something. Now I cannot find any commits for
xt_CONNMARK.h or xt_connmark.h since 2006, especially around August
14, but that might be my naivete.
If I clone Linus's repository to a x86 machine, I get no corruption.
My wild ass guess is that being big-endian is causing trouble.
-- Perry
^ permalink raw reply
* Re: git push (mis ?)behavior
From: Miles Bader @ 2007-10-03 5:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pierre Habouzit, git
In-Reply-To: <7v3awzvrpr.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I think it is sensible to have an option to make it push only the
> current branch. I am not sure if it is sensible to make that the
> default.
I really like the current default, it matches my mental model well: I
generally use "push" to mean "synchronize the remote repository with my
current one"; if multiple branches have changed, I want those changes
propagated too.
I think changing it would be a bad idea, it just seems a pointlessly
incompatible change. The reasons I've seen offered on this thread for
changing the default seem pretty weak, e.g., "it's more conservative"
(but more annoying), and "it's more like SVK" (who cares?).
-Miles
--
Freedom's just another word, for nothing left to lose --Janis Joplin
^ permalink raw reply
* Re: [PATCH] the ar tool is called gar on some systems
From: Junio C Hamano @ 2007-10-03 4:55 UTC (permalink / raw)
To: Robert Schiele; +Cc: git
In-Reply-To: <20071003014934.GF20753@schiele.dyndns.org>
Robert Schiele <rschiele@gmail.com> writes:
> Some systems that have only installed the GNU toolchain (prefixed with "g")
> do not provide "ar" but only "gar". Make configure find this tool as well.
>
> Signed-off-by: Robert Schiele <rschiele@gmail.com>
> ---
> I sent that some weeks ago but it seems it got lost.
I still have the original one in my mailbox. Hasn't applied as
we hadn't heard anybody cheering or thanking for the patch, but
I do not see anything _wrong_ with it, so let's apply.
^ permalink raw reply
* Re: WIP: asciidoc replacement
From: Jeff King @ 2007-10-03 4:51 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Sam Vilain, git, msysgit
In-Reply-To: <Pine.LNX.4.64.0710030506360.28395@racer.site>
On Wed, Oct 03, 2007 at 05:23:35AM +0100, Johannes Schindelin wrote:
> > > #!/usr/bin/perl
> >
> > Add -w for warnings, also use strict;
>
> <dumb>What does "use strict;" imply?</dumb>
Try "perldoc strict" for details.
> > > if ($par =~ /^\. /s) {
> > > my @lines = split(/^\. /m, $par);
> > > shift @lines;
> > > $conv->enumeration(\@lines);
> > > } elsif ($par =~ /^\* /s) {
> >
> > uncuddle your elsif's;
>
> I'm sorry... What do you mean?
I think he means reformatting to
if (condition) {
}
elsif (condition) {
}
> > $result = ( $par =~ /^\. /s ? $conv->do_enum($par) :
> > $par =~ /^\[verse\]/ ? $conv->do_verse($par) :
> > ... )
>
> I do not like that way... is it Perl standard to code like that?
It's quite common if you have a dispatch function, but obviously not
required.
> > > $title =~ s/\(\d+\)$//;
> > > print '.\" Title: ' . $title
> > > . '.\" Author: ' . "\n"
> > > . '.\" Generator: ' . $self->{generator} . "\n"
> > > . '.\" Date: ' . $self->{date} . "\n"
> > > . '.\" Manual: ' . $self->{manual} . "\n"
> > > . '.\" Source: ' . $self->{git_version} . "\n"
> > > . '.\"' . "\n";
> > > }
> >
> > I'd consider a HERE-doc, or multi-line qq{ } more readable than this.
>
> Can you give me an example of a HERE-doc? (What I tried to avoid is
> having ugly indentation-breaking tlobs.)
print <<EOF;
foo
EOF
HERE-docs necessarily break indentation unless you strip it out manually
(which is inefficient and ugly).
But two things that might make that look better are using qq// (to avoid
having to escape quotes) and interpolating the variables:
. qq/." Generator: $self->{generator}\n/
> I'll try to find something about qq{} in the docs.
It's in perlop, but it's basically a fancy way of double-quoting, except
that you get to choose the delimiter.
> > > $text =~ s/([^\n]) *\n([^\n])/\1 \2/g;
> >
> > "." is the same as [^\n] (without the 's' modifier).
>
> But I need the (implicit) 's' modifier, otherwise the "\n" in the middle
> is not interpreted correctly. This regsub is meant to unwrap the
> paragraph and put it into a very long line (but leaving \n\n alone).
I think you might be confused about how the 's' modifier works. You are
not using it, so '.' is the same as '[^\n]'. Perl will always match a
newline if it's in your regex. If you specify 'm', then it will also
allow '^' and '$' to match at line boundaries (instead of just at the
beginning and end of the string).
-Peff
^ permalink raw reply
* Re: WIP: asciidoc replacement
From: Junio C Hamano @ 2007-10-03 4:48 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, msysgit
In-Reply-To: <Pine.LNX.4.64.0710030133020.28395@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> So here it is: a perl script that does a good job on many .txt files in
> Documentation/, although for some it deviates from "make man"'s output,
> and for others it is outright broken. It is meant to be run in
> Documentation/.
>
> My intention is not to fix the script for all cases, but to make patches
> to Documentation/*.txt themselves, so that they are more consistent (and
> incidentally nicer to the script).
How you spend your time is up to you, but I need to wonder...
- Is "man" format important for msysGit aka Windows
environment? I had an impression that their helpfile format
were closer to "html" output.
- Does it make sense in the longer term for us to maintain
in-house documentation tools? Can we afford it?
It appears that we heard about breakages for every minor docbook
updates, and it is really appealing if we do not have to rely on
xsl toolchain for manpage generation. But if patching the text
means making it compatible with the in-house script _and_
incompatible with AsciiDoc, hmmm...
^ permalink raw reply
* Re: git-diff not showing changes (corrupt repo?)
From: Jeff King @ 2007-10-03 4:38 UTC (permalink / raw)
To: Dan Zwell; +Cc: Junio C Hamano, git, Martin Waitz, Linus Torvalds
In-Reply-To: <470313D0.7020808@gmail.com>
On Tue, Oct 02, 2007 at 11:00:16PM -0500, Dan Zwell wrote:
> You're absolutely right, my pager was being called and exiting. My system
> configuration must be dodgy, because "echo hi | less --quit-if-one-screen"
> does not display anything unless it in run in "screen". But that's not git's
This is obviously getting into less debugging (about which I know
little), but it's possible that you have a bogus TERM setting.
> fault, and I just need different options, for now. Thanks a lot for helping
> me solve this.
Thank you for providing such helpful details. It really makes a
difference.
-Peff
^ permalink raw reply
* Re: [PATCH] Change "refs/" references to symbolic constants
From: Jeff King @ 2007-10-03 4:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, Andy Parkins, git
In-Reply-To: <Pine.LNX.4.64.0710030503520.28395@racer.site>
On Wed, Oct 03, 2007 at 05:05:15AM +0100, Johannes Schindelin wrote:
> I wonder, I wonder, if
>
> strbuf_addstr(&url, repo->base);
> strbuf_addstr(&url, "/objects/pack/pack-");
> strbuf_addstr(&url, hex);
> strbuf_addstr(&url, ".idx");
>
> would make anybody else but me happy...
I actually wrote that originally, and then switched to the formatted
version for readability. But I would be happy with that, as well, if we
are truly concerned about the cost of 2 snprintfs.
-Peff
^ permalink raw reply
* Re: WIP: asciidoc replacement
From: Johannes Schindelin @ 2007-10-03 4:23 UTC (permalink / raw)
To: Sam Vilain; +Cc: git, msysgit
In-Reply-To: <4702F6BB.60908@vilain.net>
Hi,
On Wed, 3 Oct 2007, Sam Vilain wrote:
> Johannes Schindelin wrote:
>
> > I do not want to depend on more than necessary in msysGit, and
> > therefore I started to write an asciidoc replacement.
>
> It's pretty good, I certainly wouldn't have trouble reading or
> maintaining it, but I'll give you suggestions anyway.
Thank you very much! (On both accounts...)
> nice work, replacing a massive XML/XSL/etc stack with a small Perl
> script ;-)
Uhm... It is less capable, though...
> > -- snip --
> > #!/usr/bin/perl
>
> Add -w for warnings, also use strict;
<dumb>What does "use strict;" imply?</dumb>
> > sub handle_text {
>
> this function acts on globals; make them explicit arguments to the
> function.
Actually, it resets the global $par. Should I rather make it a class?
> > if ($par =~ /^\. /s) {
> > my @lines = split(/^\. /m, $par);
> > shift @lines;
> > $conv->enumeration(\@lines);
> > } elsif ($par =~ /^\* /s) {
>
> uncuddle your elsif's;
I'm sorry... What do you mean?
> also consider making this a "tabular ternary" with the actions in
> separate functions.
>
> ie
>
> $result = ( $par =~ /^\. /s ? $conv->do_enum($par) :
> $par =~ /^\[verse\]/ ? $conv->do_verse($par) :
> ... )
I do not like that way... is it Perl standard to code like that?
> However I have a suspicion that your script is doing line-based parsing
> instead of recursive descent; I don't know whether that's the right
> thing for asciidoc. It's actually fairly easy to convert a grammar to
> code blocks using tricks from MJD's _Higher Order Perl_. Is it
> necessary for the asciidoc grammar?
I wanted to keep it simple. So I'll try to stay away from any fancy
grammar parsing, and stay with "read lines until you have something to
process".
> > # handle gitlink:
> > s/gitlink:([^\[ ]*)\[(\d+)\]/sprintf "%s",
> > $conv->get_link($1, $2)/ge;
> > # handle link:
> > s/link:([^\[ ]*)\[(.+)\]/sprintf "%s",
> > $conv->get_link($1, $2, 'external')/ge;
>
> These REs suffer from LTS (Leaning Toothpick Syndrome). Consider using
> s{foo}{bar} and adding the 'x' modifier to space out groups.
I guess you mean the forward slash. Alas, that's what I'm used to, and
I'd rather not change it unless forced to... lest I stop understanding my
own code!
(Besides, I did not find _any_ example showing why "x" should be useful.)
> > if ($self->{preamble_shown} == undef) {
> > $title = $text;
> > $title =~ s/\(\d+\)$//;
> > print '.\" Title: ' . $title
> > . '.\" Author: ' . "\n"
> > . '.\" Generator: ' . $self->{generator} . "\n"
> > . '.\" Date: ' . $self->{date} . "\n"
> > . '.\" Manual: ' . $self->{manual} . "\n"
> > . '.\" Source: ' . $self->{git_version} . "\n"
> > . '.\"' . "\n";
> > }
>
> I'd consider a HERE-doc, or multi-line qq{ } more readable than this.
Can you give me an example of a HERE-doc? (What I tried to avoid is
having ugly indentation-breaking tlobs.)
> > $text =~ tr/a-z/A-Z/;
> > my $suffix = "\"$self->{date}\" \"$self->{git_version}\""
> > . " \"$self->{manual}\"";
>
> Use qq{} when making strings with lots of embedded double quotes and
> interpolation.
I'll try to find something about qq{} in the docs.
> > $text =~ s/^(.*)\((\d+)\)$/.TH "\1" "\2" $suffix/;
> > print $text;
> >
> > if ($self->{preamble_shown} == undef) {
> > print '.\" disable hyphenation' . "\n"
> > . '.nh' . "\n"
> > . '.\" disable justification (adjust text to left'
> > . ' margin only)' . "\n"
> > . '.ad l' . "\n";
>
> Using commas rather than "." will safe you a concat when printing to
> filehandles, but that's a very small nit to pick :)
Does that also work with older perl? IIRC there was some strange problem
with my perl when lots of code in git.git was changed to using commata.
> > # handle <<sections>
> > $text =~ s/<<([^>]*)>>/the section called \\(lq\1\\(rq/g;
>
> Hmm, that regex would not match for <<foo > bar>>, if you care you'd
> need to write something like <<((?:[^>]+|>[^>])*)>>
I'd rather leave it as is -- this script is not meant to grok all kind of
sh*t. It is meant to make translating the docs as fast and uncumbersome
as possible. Which will involve making the documentation more consistent
(in and of itself something I rather like).
So unless there comes a compelling reason, I'd rather leave it.
> > sub begin_item {
> > my ($self, $item, $text) = @_;
> >
> > $item = $self->common($item);
> > $text = $self->common($text);
> >
> > $text =~ s/([^\n]) *\n([^\n])/\1 \2/g;
>
> "." is the same as [^\n] (without the 's' modifier).
But I need the (implicit) 's' modifier, otherwise the "\n" in the middle
is not interpreted correctly. This regsub is meant to unwrap the
paragraph and put it into a very long line (but leaving \n\n alone).
> > sub finish {
> > my ($self) = @_;
> > my $links = $self->{links};
> >
> > if ($#$links >= 0) {
> > print '.SH "REFERENCES"' . "\n";
> > my $i = 1;
> > while ($#$links >= 0) {
>
> just use if (@$links) and while (@$links)
Thanks. I hoped there would be something like this.
Another thing: if I want to add some documentation, what would be the
common way to do it? =pod...=cut?
Thank you for all your tips!
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] diffcore-rename: cache file deltas
From: Junio C Hamano @ 2007-10-03 4:10 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Jeff King, git
In-Reply-To: <alpine.LFD.0.999.0710021832520.3579@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Well, that renaming apparently never happened, and it's still called
> diff_free_filespec_data_large() now that it's in master.
>
> That said, I think this patch should make it into the maintenance branch
> too, renamed or not, since it's such a huge performance issue.
Thanks.
^ permalink raw reply
* Re: [PATCH] Change "refs/" references to symbolic constants
From: Johannes Schindelin @ 2007-10-03 4:05 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Andy Parkins, git
In-Reply-To: <20071003025853.GA11440@coredump.intra.peff.net>
Hi,
On Tue, 2 Oct 2007, Jeff King wrote:
> On Tue, Oct 02, 2007 at 05:22:23PM -0700, Junio C Hamano wrote:
>
> > > strbuf_init(&url);
> > > strbuf_addf(&url, "%s/objects/pack/pack-%s.idx", repo->base, hex);
> >
> > Ugh, this typically calls snprintf() twice doesn't it?
>
> Yes, it probably does. However, I think it is considerably easier to
> read and more maintainable. Are you "ugh"ing because of the performance
> impact (which should be negligible unless this is in a tight loop) or
> because of the portability problems associated with va_copy?
I wonder, I wonder, if
strbuf_addstr(&url, repo->base);
strbuf_addstr(&url, "/objects/pack/pack-");
strbuf_addstr(&url, hex);
strbuf_addstr(&url, ".idx");
would make anybody else but me happy...
Ciao,
Dscho
^ permalink raw reply
* Re: git-diff not showing changes (corrupt repo?)
From: Dan Zwell @ 2007-10-03 4:00 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, git, Martin Waitz, Linus Torvalds
In-Reply-To: <20071003032331.GA11638@coredump.intra.peff.net>
Jeff King wrote:
> On Tue, Oct 02, 2007 at 10:17:41PM -0500, Dan Zwell wrote:
>
>> e88ee2915493213ea0d0be64c542c090fefd4b33 is first bad commit
>> commit e88ee2915493213ea0d0be64c542c090fefd4b33
>> Author: Martin Waitz <tali@admingilde.org>
>> Date: Tue Oct 10 21:16:25 2006 +0200
>>
>> paginate git-diff by default
>
> The only thing this patch does is run the pager, so presumably git-diff
> _is_ generating output, but calling the pager is broken for some reason.
> What is the value of $GIT_PAGER and $PAGER on the broken and working
> machines? Can you confirm that the pager works on both machines?
>
You're absolutely right, my pager was being called and exiting. My
system configuration must be dodgy, because "echo hi | less
--quit-if-one-screen" does not display anything unless it in run in
"screen". But that's not git's fault, and I just need different options,
for now. Thanks a lot for helping me solve this.
Dan
>
> -Peff
>
^ permalink raw reply
* Re: git-diff not showing changes (corrupt repo?)
From: Linus Torvalds @ 2007-10-03 3:44 UTC (permalink / raw)
To: Dan Zwell; +Cc: Junio C Hamano, git, Martin Waitz, Jeff King
In-Reply-To: <470309D5.702@gmail.com>
On Tue, 2 Oct 2007, Dan Zwell wrote:
>
> I bisected twice to be sure, and have CC'd Martin Waitz on this (the issue is
> that some of my changes in a local repo are not being displayed by git-diff,
> either before or after they are committed, but git-status, git-whatchanged,
> and git-diff-tree all see that changes have been committed, and git-diff-files
> does see uncommitted changes).
>
> e88ee2915493213ea0d0be64c542c090fefd4b33 is first bad commit
You most likely have a very buggy "less".
Try this:
echo hello | less -FRSX
on the command line. Do you see the "hello"?
(The above is assuming you haven't set GIT_PAGER, PAGER or the LESS
variables manually to something else)
Linus
^ permalink raw reply
* Re: git-diff not showing changes (corrupt repo?)
From: Jeff King @ 2007-10-03 3:23 UTC (permalink / raw)
To: Dan Zwell; +Cc: Junio C Hamano, git, Martin Waitz
In-Reply-To: <470309D5.702@gmail.com>
On Tue, Oct 02, 2007 at 10:17:41PM -0500, Dan Zwell wrote:
> e88ee2915493213ea0d0be64c542c090fefd4b33 is first bad commit
> commit e88ee2915493213ea0d0be64c542c090fefd4b33
> Author: Martin Waitz <tali@admingilde.org>
> Date: Tue Oct 10 21:16:25 2006 +0200
>
> paginate git-diff by default
The only thing this patch does is run the pager, so presumably git-diff
_is_ generating output, but calling the pager is broken for some reason.
What is the value of $GIT_PAGER and $PAGER on the broken and working
machines? Can you confirm that the pager works on both machines?
> I discovered this problem on my 64 bit machine, but the problem does not
> occur on my 32 bit machine. That is not the only difference between the two
> computers, but it seems the most obvious culprit. The 64 bit machine may
> have different libraries than the other, as they are running different
> distros.
I couldn't reproduce on my 32-bit or 64-bit machine (the former running
Debian unstable, the latter Debian stable). But given the patch you
bisected to, I think it is more likely that your pager is broken on the
64-bit machine.
-Peff
^ permalink raw reply
* Re: git-diff not showing changes (corrupt repo?)
From: Dan Zwell @ 2007-10-03 3:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Martin Waitz, Jeff King
In-Reply-To: <7vbqbhl44h.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
> Dan Zwell <dzwell@gmail.com> writes:
>
>> ... It is the same after I commit the new changes--at that point,
>> "git-diff-tree HEAD^ HEAD -p" spits out a nice patch, but "git-diff
>> HEAD^ HEAD" gives nothing.
>
> This part is most interesting. They are both about comparing
> two commits and do not interact with anything in the work tree
> nor your index.
>
> ... Can you bisect it?
>
I bisected twice to be sure, and have CC'd Martin Waitz on this (the
issue is that some of my changes in a local repo are not being displayed
by git-diff, either before or after they are committed, but git-status,
git-whatchanged, and git-diff-tree all see that changes have been
committed, and git-diff-files does see uncommitted changes).
e88ee2915493213ea0d0be64c542c090fefd4b33 is first bad commit
commit e88ee2915493213ea0d0be64c542c090fefd4b33
Author: Martin Waitz <tali@admingilde.org>
Date: Tue Oct 10 21:16:25 2006 +0200
paginate git-diff by default
I discovered this problem on my 64 bit machine, but the problem does not
occur on my 32 bit machine. That is not the only difference between the
two computers, but it seems the most obvious culprit. The 64 bit machine
may have different libraries than the other, as they are running
different distros.
I noticed that this is a rather old (and very small) patch, and I don't
quite understand how it could cause this problem. I could not revert the
patch to fix the problem. I placed a stripped down version of the
repository here: http://zwell.net/git-error.tar.gz. The problem is very
easy to observe on my machine, though it looks like some machines do not
exhibit it. What else can I do to help?
Dan
^ permalink raw reply
* Re: [PATCH] Change "refs/" references to symbolic constants
From: Jeff King @ 2007-10-03 2:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andy Parkins, git
In-Reply-To: <7vr6kdhwsg.fsf@gitster.siamese.dyndns.org>
On Tue, Oct 02, 2007 at 05:22:23PM -0700, Junio C Hamano wrote:
> > strbuf_init(&url);
> > strbuf_addf(&url, "%s/objects/pack/pack-%s.idx", repo->base, hex);
>
> Ugh, this typically calls snprintf() twice doesn't it?
Yes, it probably does. However, I think it is considerably easier to
read and more maintainable. Are you "ugh"ing because of the performance
impact (which should be negligible unless this is in a tight loop) or
because of the portability problems associated with va_copy?
-Peff
^ permalink raw reply
* [PATCH] Restore default verbosity for http fetches.
From: Daniel Barkalow @ 2007-10-03 2:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
This adds a verbosity level below 0 for suppressing default messages
with --quiet, and makes the default for http be verbose instead of
quiet. This matches the behavior of the shell script version of git-fetch.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
builtin-fetch.c | 2 +-
transport.c | 10 +++++-----
transport.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index ac68ff5..cf7498b 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -533,7 +533,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
if (verbose >= 2)
transport->verbose = 1;
if (quiet)
- transport->verbose = 0;
+ transport->verbose = -1;
if (upload_pack)
set_option(TRANS_OPT_UPLOADPACK, upload_pack);
if (keep)
diff --git a/transport.c b/transport.c
index 7266fd3..6fe6ec8 100644
--- a/transport.c
+++ b/transport.c
@@ -161,7 +161,7 @@ static struct ref *get_refs_via_rsync(const struct transport *transport)
rsync.argv = args;
rsync.stdout_to_stderr = 1;
args[0] = "rsync";
- args[1] = transport->verbose ? "-rv" : "-r";
+ args[1] = (transport->verbose > 0) ? "-rv" : "-r";
args[2] = buf.buf;
args[3] = temp_dir.buf;
args[4] = NULL;
@@ -214,7 +214,7 @@ static int fetch_objs_via_rsync(struct transport *transport,
rsync.argv = args;
rsync.stdout_to_stderr = 1;
args[0] = "rsync";
- args[1] = transport->verbose ? "-rv" : "-r";
+ args[1] = (transport->verbose > 0) ? "-rv" : "-r";
args[2] = "--ignore-existing";
args[3] = "--exclude";
args[4] = "info";
@@ -290,7 +290,7 @@ static int rsync_transport_push(struct transport *transport,
rsync.argv = args;
rsync.stdout_to_stderr = 1;
args[0] = "rsync";
- args[1] = transport->verbose ? "-av" : "-a";
+ args[1] = (transport->verbose > 0) ? "-av" : "-a";
args[2] = "--ignore-existing";
args[3] = "--exclude";
args[4] = "info";
@@ -344,7 +344,7 @@ static int fetch_objs_via_walker(struct transport *transport,
walker->get_all = 1;
walker->get_tree = 1;
walker->get_history = 1;
- walker->get_verbosely = transport->verbose;
+ walker->get_verbosely = transport->verbose >= 0;
walker->get_recover = 0;
for (i = 0; i < nr_objs; i++)
@@ -637,7 +637,7 @@ static int fetch_refs_via_pack(struct transport *transport,
args.keep_pack = data->keep;
args.lock_pack = 1;
args.use_thin_pack = data->thin;
- args.verbose = transport->verbose;
+ args.verbose = transport->verbose > 0;
args.depth = data->depth;
for (i = 0; i < nr_heads; i++)
diff --git a/transport.h b/transport.h
index 6e318e4..4bb51d7 100644
--- a/transport.h
+++ b/transport.h
@@ -24,7 +24,7 @@ struct transport {
int (*disconnect)(struct transport *connection);
char *pack_lockfile;
- unsigned verbose : 1;
+ signed verbose : 2;
};
#define TRANSPORT_PUSH_ALL 1
--
1.5.3.2.1107.ge9eab8-dirty
^ permalink raw reply related
* Re: What's cooking in git.git (topics)
From: Linus Torvalds @ 2007-10-03 2:28 UTC (permalink / raw)
To: David Kastrup, Jeff King; +Cc: Git Mailing List
In-Reply-To: <86ve9p32cp.fsf@lola.quinscape.zz>
[ This is the discussed stupid approach - just sort the dang hash array,
so that we can use a linear scan over the src/dst ]
On Tue, 2 Oct 2007, David Kastrup wrote:
>
> This does not actually require an actual merge _sort_ AFAICS: do the
> "sort file.hashed" step using qsort. The comparison step does not
> actually need to produce merged output, but merely advances through
> two hash arrays and generates statistics.
>
> This should already beat the pants off the current implementation,
> even when the hash array is sparse, simply because our inner loop then
> has perfect hash coherence.
Sadly, that's not the case. It *does* seem to beat the current
implementation, but it's not "beat the pants off". It looks like an
improvement of about 15%, which is nothing to sneeze at, but it's not an
order-of-magnitude improvement either.
Here's a test-patch. I don't guarantee anything, except that when I did
the timings I also did a "wc" on the result, and they matched..
Before:
[torvalds@woody linux]$ time git diff -l0 --stat -C v2.6.22.. | wc
7104 28574 438020
real 0m10.526s
user 0m10.401s
sys 0m0.136s
After:
[torvalds@woody linux]$ time ~/git/git diff -l0 --stat -C v2.6.22.. | wc
7104 28574 438020
real 0m8.876s
user 0m8.761s
sys 0m0.128s
but the diff is fairly simple, so if somebody will go over it and say
whether it's likely to be *correct* too, that 15% may well be worth it.
[ Side note, without rename detection, that diff takes just under three
seconds for me, so in that sense the improvement to the rename detection
itself is larger than the overall 15% - it brings the cost of just
rename detection from 7.5s to 5.9s, which would be on the order of just
over a 20% performance improvement. ]
Hmm. The patch depends on half-way subtle issues like the fact that the
hashtables are guaranteed to not be full => we're guaranteed to have zero
counts at the end => we don't need to do any steenking iterator count in
the loop. A few comments might in order.
Linus
---
diffcore-delta.c | 54 ++++++++++++++++++++++++++++++------------------------
1 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/diffcore-delta.c b/diffcore-delta.c
index d9729e5..6d65697 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -46,22 +46,6 @@ struct spanhash_top {
struct spanhash data[FLEX_ARRAY];
};
-static struct spanhash *spanhash_find(struct spanhash_top *top,
- unsigned int hashval)
-{
- int sz = 1 << top->alloc_log2;
- int bucket = hashval & (sz - 1);
- while (1) {
- struct spanhash *h = &(top->data[bucket++]);
- if (!h->cnt)
- return NULL;
- if (h->hashval == hashval)
- return h;
- if (sz <= bucket)
- bucket = 0;
- }
-}
-
static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
{
struct spanhash_top *new;
@@ -122,6 +106,20 @@ static struct spanhash_top *add_spanhash(struct spanhash_top *top,
}
}
+static int spanhash_cmp(const void *_a, const void *_b)
+{
+ const struct spanhash *a = _a;
+ const struct spanhash *b = _b;
+
+ /* A count of zero compares at the end.. */
+ if (!a->cnt)
+ return !b->cnt ? 0 : 1;
+ if (!b->cnt)
+ return -1;
+ return a->hashval < b->hashval ? -1 :
+ a->hashval > b->hashval ? 1 : 0;
+}
+
static struct spanhash_top *hash_chars(struct diff_filespec *one)
{
int i, n;
@@ -158,6 +156,10 @@ static struct spanhash_top *hash_chars(struct diff_filespec *one)
n = 0;
accum1 = accum2 = 0;
}
+ qsort(hash->data,
+ 1ul << hash->alloc_log2,
+ sizeof(hash->data[0]),
+ spanhash_cmp);
return hash;
}
@@ -169,7 +171,7 @@ int diffcore_count_changes(struct diff_filespec *src,
unsigned long *src_copied,
unsigned long *literal_added)
{
- int i, ssz;
+ struct spanhash *s, *d;
struct spanhash_top *src_count, *dst_count;
unsigned long sc, la;
@@ -190,22 +192,26 @@ int diffcore_count_changes(struct diff_filespec *src,
}
sc = la = 0;
- ssz = 1 << src_count->alloc_log2;
- for (i = 0; i < ssz; i++) {
- struct spanhash *s = &(src_count->data[i]);
- struct spanhash *d;
+ s = src_count->data;
+ d = dst_count->data;
+ for (;;) {
unsigned dst_cnt, src_cnt;
if (!s->cnt)
- continue;
+ break;
+ while (d->cnt) {
+ if (d->hashval >= s->hashval)
+ break;
+ d++;
+ }
src_cnt = s->cnt;
- d = spanhash_find(dst_count, s->hashval);
- dst_cnt = d ? d->cnt : 0;
+ dst_cnt = d->hashval == s->hashval ? d->cnt : 0;
if (src_cnt < dst_cnt) {
la += dst_cnt - src_cnt;
sc += src_cnt;
}
else
sc += dst_cnt;
+ s++;
}
if (!src_count_p)
^ permalink raw reply related
* Re: WIP: asciidoc replacement
From: Sam Vilain @ 2007-10-03 1:56 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, msysgit
In-Reply-To: <Pine.LNX.4.64.0710030133020.28395@racer.site>
Johannes Schindelin wrote:
> Hi,
>
> I do not want to depend on more than necessary in msysGit, and therefore I
> started to write an asciidoc replacement.
>
> So here it is: a perl script that does a good job on many .txt files in
> Documentation/, although for some it deviates from "make man"'s output,
> and for others it is outright broken. It is meant to be run in
> Documentation/.
>
> My intention is not to fix the script for all cases, but to make patches
> to Documentation/*.txt themselves, so that they are more consistent (and
> incidentally nicer to the script).
>
> Now, I hear you already moan: "But Dscho, you know you suck at Perl!"
>
> Yeah, I know, but maybe instead of bashing on me (pun intended), you may
> want to enlighten me with tips how to make it nicer to read. (Yes, there
> are no comments; yes, I will gladly add them where appropriate; yes, html
> is just a stub.)
>
> So here, without further ado, da script:
It's pretty good, I certainly wouldn't have trouble reading or
maintaining it, but I'll give you suggestions anyway.
nice work, replacing a massive XML/XSL/etc stack with a small Perl
script ;-)
Sam.
>
> -- snip --
> #!/usr/bin/perl
Add -w for warnings, also use strict;
> $conv = new man_page();
> $conv->{manual} = 'Git Manual';
> $conv->{git_version} = 'Git ' . `cat ../GIT-VERSION-FILE`;
> $conv->{git_version} =~ s/GIT_VERSION = //;
> $conv->{git_version} =~ s/-/\\-/;
> $conv->{git_version} =~ s/\n//;
> $conv->{date} = `date +%m/%d/%Y`;
> $conv->{date} =~ s/\n//;
>
> $par = '';
> handle_file($ARGV[0]);
> $conv->finish();
>
> sub handle_text {
this function acts on globals; make them explicit arguments to the function.
> if ($par =~ /^\. /s) {
> my @lines = split(/^\. /m, $par);
> shift @lines;
> $conv->enumeration(\@lines);
> } elsif ($par =~ /^\* /s) {
uncuddle your elsif's; also consider making this a "tabular ternary"
with the actions in separate functions.
ie
$result = ( $par =~ /^\. /s ? $conv->do_enum($par) :
$par =~ /^\[verse\]/ ? $conv->do_verse($par) :
... )
However I have a suspicion that your script is doing line-based parsing
instead of recursive descent; I don't know whether that's the right
thing for asciidoc. It's actually fairly easy to convert a grammar to
code blocks using tricks from MJD's _Higher Order Perl_. Is it
necessary for the asciidoc grammar?
> my @lines = split(/^\* /m, $par);
> shift @lines;
> $conv->enumeration(\@lines, 'unnumbered');
> } elsif ($par =~ /^\[verse\]/) {
> $par =~ s/\[verse\] *\n?//;
> $conv->verse($par);
> } elsif ($par =~ /^(\t| +)/s) {
> $par =~ s/^$1//mg;
> $par =~ s/^\+$//mg;
> $conv->indent($par);
> } elsif ($par =~ /^([^\n]*)::\n((\t| +).*)$/s) {
> my ($first, $rest, $indent) = ($1, $2, $3);
> $rest =~ s/^\+$//mg;
> while ($rest =~ /^(.*?\n\n)--+\n(.*?\n)--+\n\n(.*)$/s) {
> my ($pre, $verb, $post) = ($1, $2, $3);
>
> $pre =~ s/^(\t|$indent)//mg;
> if ($first ne '') {
> $conv->begin_item($first, $pre);
> $first = '';
> } else {
> $conv->normal($pre);
> }
>
> $conv->verbatim($verb);
> $rest = $post;
> }
> $rest =~ s/^(\t|$indent)//mg;
> if ($first ne '') {
> $conv->begin_item($first, $rest);
> } else {
> $conv->normal($rest);
> }
> $conv->end_item();
> } elsif ($par =~ /^-+\n(.*\n)-+\n$/s) {
> $conv->verbatim($1);
> } else {
> $conv->normal($par);
> }
> $par = '';
> }
>
> sub handle_file {
> my $in;
> open($in, '<' . $_[0]);
> while (<$in>) {
> if (/^=+$/) {
> if ($par ne '' && length($_) >= length($par)) {
> $conv->header($par);
> $par = '';
> next;
> }
> } elsif (/^-+$/) {
> if ($par ne '' && length($_) >= length($par)) {
> $conv->section($par);
> $par = '';
> next;
> }
> } elsif (/^~+$/) {
> if ($par ne '' && length($_) >= length($par)) {
> $conv->subsection($par);
> $par = '';
> next;
> }
> } elsif (/^\[\[(.*)\]\]$/) {
> handle_text();
> $conv->anchor($1);
> next;
> } elsif (/^$/) {
> if ($par =~ /^-+\n.*[^-]\n$/s) {
> # fallthru; is verbatim, but needs more.
> } elsif ($par =~ /::\n$/s) {
> # is item, but needs more.
> next;
> } else {
> handle_text();
> next;
> }
> } elsif (/^include::(.*)\[\]$/) {
> handle_text();
> handle_file($1);
> next;
> }
>
> # convert "\--" to "--"
> s/\\--/--/g;
> # convert "\*" to "*"
> s/\\\*/*/g;
>
> # handle gitlink:
> s/gitlink:([^\[ ]*)\[(\d+)\]/sprintf "%s",
> $conv->get_link($1, $2)/ge;
> # handle link:
> s/link:([^\[ ]*)\[(.+)\]/sprintf "%s",
> $conv->get_link($1, $2, 'external')/ge;
These REs suffer from LTS (Leaning Toothpick Syndrome). Consider using
s{foo}{bar} and adding the 'x' modifier to space out groups.
>
> $par .= $_;
> }
> close($in);
> handle_text();
> }
>
> package man_page;
>
> sub new {
> my ($class) = @_;
> my $self = {
> sep => '',
> links => [],
> # generator => 'Home grown git txt2man converter'
> generator => 'DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>'
> };
> bless $self, $class;
> return $self;
> }
>
> sub header {
> my ($self, $text) = @_;
> $text =~ s/-/\\-/g;
>
> if ($self->{preamble_shown} == undef) {
> $title = $text;
> $title =~ s/\(\d+\)$//;
> print '.\" Title: ' . $title
> . '.\" Author: ' . "\n"
> . '.\" Generator: ' . $self->{generator} . "\n"
> . '.\" Date: ' . $self->{date} . "\n"
> . '.\" Manual: ' . $self->{manual} . "\n"
> . '.\" Source: ' . $self->{git_version} . "\n"
> . '.\"' . "\n";
> }
I'd consider a HERE-doc, or multi-line qq{ } more readable than this.
>
> $text =~ tr/a-z/A-Z/;
> my $suffix = "\"$self->{date}\" \"$self->{git_version}\""
> . " \"$self->{manual}\"";
Use qq{} when making strings with lots of embedded double quotes and
interpolation.
> $text =~ s/^(.*)\((\d+)\)$/.TH "\1" "\2" $suffix/;
> print $text;
>
> if ($self->{preamble_shown} == undef) {
> print '.\" disable hyphenation' . "\n"
> . '.nh' . "\n"
> . '.\" disable justification (adjust text to left'
> . ' margin only)' . "\n"
> . '.ad l' . "\n";
Using commas rather than "." will safe you a concat when printing to
filehandles, but that's a very small nit to pick :)
> $self->{preamble_shown} = 1;
> }
>
> $self->{last_op} = 'header';
> }
>
> sub section {
> my ($self, $text) = @_;
>
> $text =~ tr/a-z/A-Z/;
> $text =~ s/^(.*)$/.SH "\1"/;
>
> print $text;
>
> $self->{last_op} = 'section';
> }
>
> sub subsection {
> my ($self, $text) = @_;
>
> $text =~ s/^(.*)$/.SS "\1"/;
>
> print $text;
>
> $self->{last_op} = 'subsection';
> }
>
> sub get_link {
> my ($self, $command, $section, $option) = @_;
>
> if ($option eq 'external') {
> my $links = $self->{links};
> push(@$links, $command);
> $command =~ s/\.html$//;
> $command =~ s/-/ /g;
> push(@$links, $command);
> return '\fI' . $command . '\fR\&[1]';
> } else {
> return '\fB' . $command . '\fR(' . $section . ')';
> }
> }
>
> sub common {
> my ($self, $text, $option) = @_;
>
> # escape backslashes, but not in "\n", "\&" or "\fB"
> $text =~ s/\\(?!n|f[A-Z]|&)/\\\\/g;
> # escape "-"
> $text =~ s/-/\\-/g;
> # handle ...
> $text =~ s/(\.\.\.)/\\&\1/g;
> # remove double space after full stop or comma
> $text =~ s/([\.,]) /\1 /g;
>
> if ($option ne 'no-markup') {
> # make 'italic'
> $text =~ s/'([^'\n]*)'/\\fI\1\\fR/g;
> # ignore `
> $text =~ s/`//g;
> # make *bold*
> $text =~ s/\*([^\*\n]*)\*/\\fB\1\\fR/g;
> # handle <<sections>
> $text =~ s/<<([^>]*)>>/the section called \\(lq\1\\(rq/g;
Hmm, that regex would not match for <<foo > bar>>, if you care you'd
need to write something like <<((?:[^>]+|>[^>])*)>>
> }
>
> return $text;
> }
>
> sub normal {
> my ($self, $text) = @_;
>
> if ($text eq "") {
> return;
> }
>
> $text = $self->common($text);
>
> $text =~ s/ *\n(.)/ \1/g;
>
> if ($self->{last_op} eq 'normal') {
> print "\n";
> }
>
> print $text;
>
> $self->{last_op} = 'normal';
> }
>
> sub verse {
> my ($self, $text) = @_;
>
> $text = $self->common($text);
> $text =~ s/^\t/ /mg;
>
> print ".sp\n.RS 4\n.nf\n" . $text . ".fi\n.RE\n";
>
> $self->{last_op} = 'verse';
> }
>
> sub enumeration {
> my ($self, $text, $option) = @_;
>
> my $counter = 0;
> foreach $line (@$text) {
> $counter++;
> print ".TP 4\n"
> . ($option eq 'unnumbered' ? '\(bu' : $counter . '.')
> . "\n"
> . $self->common($line);
> }
>
> $self->{last_op} = 'enumeration';
> }
>
> sub begin_item {
> my ($self, $item, $text) = @_;
>
> $item = $self->common($item);
> $text = $self->common($text);
>
> $text =~ s/([^\n]) *\n([^\n])/\1 \2/g;
"." is the same as [^\n] (without the 's' modifier).
>
> print ".PP\n" . $item . "\n.RS 4\n" . $text;
>
> $self->{last_op} = 'item';
> }
>
> sub end_item {
> my ($self) = @_;
>
> print ".RE\n";
>
> $self->{last_op} = 'end_item';
> }
>
> sub indent {
> my ($self, $text) = @_;
>
> $text = $self->common($text, 'no-markup');
> $text =~ s/^\t/ /mg;
>
> if ($self->{last_op} eq 'normal') {
> print "\n";
> }
>
> print ".sp\n.RS 4\n.nf\n" . $text . ".fi\n.RE\n";
>
> $self->{last_op} = 'indent';
> }
>
> sub verbatim {
> my ($self, $text) = @_;
>
> $text = $self->common($text, 'no-markup');
>
> # convert tabs to spaces
> $text =~ s/^\t/ /mg;
> # remove trailing empty lines
> $text =~ s/\n\n*$/\n/;
>
> if ($self->{last_op} eq 'normal') {
> print "\n";
> }
>
> print ".sp\n.RS 4\n.nf\n.ft C\n" . $text . ".ft\n\n.fi\n.RE\n";
>
> $self->{last_op} = 'verbatim';
> }
>
> sub anchor {
> my ($self, $text) = @_;
>
> $self->{last_op} = 'anchor';
> }
>
> sub finish {
> my ($self) = @_;
> my $links = $self->{links};
>
> if ($#$links >= 0) {
> print '.SH "REFERENCES"' . "\n";
> my $i = 1;
> while ($#$links >= 0) {
just use if (@$links) and while (@$links)
> my $ref = shift(@$links);
> $ref =~ s/-/\\-/g;
> my $label = shift(@$links);
> printf (".IP \"% 2d.\" 4\n%s\n.RS 4\n\\%%%s\n.RE\n",
> $i++, $label, $ref);
> }
> } else {
> print "\n";
> }
> }
>
> package html_page;
>
> sub new {
> my ($class) = @_;
> my $self = {};
> bless $self, $class;
> return $self;
> }
>
> -- snap --
>
> Ciao,
> Dscho
>
> P.S.: I need to catch some Zs, and do some real work, so do not be
> surprised if I do not respond within the next 24 hours.
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] the ar tool is called gar on some systems
From: Robert Schiele @ 2007-10-03 1:49 UTC (permalink / raw)
To: git; +Cc: gitster
Some systems that have only installed the GNU toolchain (prefixed with "g")
do not provide "ar" but only "gar". Make configure find this tool as well.
Signed-off-by: Robert Schiele <rschiele@gmail.com>
---
I sent that some weeks ago but it seems it got lost.
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 84fd7f1..ed7cc89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ AC_MSG_NOTICE([CHECKS for programs])
#
AC_PROG_CC([cc gcc])
#AC_PROG_INSTALL # needs install-sh or install.sh in sources
-AC_CHECK_TOOL(AR, ar, :)
+AC_CHECK_TOOLS(AR, [gar ar], :)
AC_CHECK_PROGS(TAR, [gtar tar])
# TCLTK_PATH will be set to some value if we want Tcl/Tk
# or will be empty otherwise.
--
1.5.2.3
^ permalink raw reply related
* Re: [PATCH] diffcore-rename: cache file deltas
From: Linus Torvalds @ 2007-10-03 1:36 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7vy7eu4eos.fsf@gitster.siamese.dyndns.org>
On Tue, 25 Sep 2007, Junio C Hamano wrote:
> >
> > - the name diff_free_filespec_data_large is horrible, but this is based
> > on the fact that diff_free_filespec_data actually does too much (it
> > frees the data _and_ some other auxiliary data). And renaming that
> > would entail changing many callsites.
>
> True. But we can rename it to diff_file_filespec_blob() and
> that would perfectly well describe what it does. Will do so
> when applying if it is Ok to you.
Well, that renaming apparently never happened, and it's still called
diff_free_filespec_data_large() now that it's in master.
That said, I think this patch should make it into the maintenance branch
too, renamed or not, since it's such a huge performance issue.
Linus
^ 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