* Re: Odd behavior with git and cairo-devel repo
From: Linus Torvalds @ 2006-06-21 18:01 UTC (permalink / raw)
To: Andre Noll; +Cc: Art Haas, Junio C Hamano, git
In-Reply-To: <20060621174632.GP11245@skl-net.de>
On Wed, 21 Jun 2006, Andre Noll wrote:
>
> Fix grow_refs_hash()
Ouch.
Actually, the alternate patch is the one I had intended to do but for some
reasons didn't.
This one also removes two more lines than it adds, but it's obviously a
bigger patch.
Junio, depending on which one you prefer, add the appropriate
Acked-by: Linus Torvalds <torvalds@osdl.org>
(for Andre's one) or
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
if you take this one.
Linus
---
object-refs.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/object-refs.c b/object-refs.c
index a7d49c6..b1b8065 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -12,6 +12,18 @@ static unsigned int hash_obj(struct obje
return hash % n;
}
+static void insert_ref_hash(struct object_refs *ref, struct object_refs **hash, unsigned int size)
+{
+ int j = hash_obj(ref->base, size);
+
+ while (hash[j]) {
+ j++;
+ if (j >= size)
+ j = 0;
+ }
+ hash[j] = ref;
+}
+
static void grow_refs_hash(void)
{
int i;
@@ -20,30 +32,16 @@ static void grow_refs_hash(void)
new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
for (i = 0; i < refs_hash_size; i++) {
- int j;
struct object_refs *ref = refs_hash[i];
if (!ref)
continue;
- j = hash_obj(ref->base, new_hash_size);
- new_hash[j] = ref;
+ insert_ref_hash(ref, new_hash, new_hash_size);
}
free(refs_hash);
refs_hash = new_hash;
refs_hash_size = new_hash_size;
}
-static void insert_ref_hash(struct object_refs *ref)
-{
- int j = hash_obj(ref->base, refs_hash_size);
-
- while (refs_hash[j]) {
- j++;
- if (j >= refs_hash_size)
- j = 0;
- }
- refs_hash[j] = ref;
-}
-
static void add_object_refs(struct object *obj, struct object_refs *ref)
{
int nr = nr_object_refs + 1;
@@ -51,7 +49,7 @@ static void add_object_refs(struct objec
if (nr > refs_hash_size * 2 / 3)
grow_refs_hash();
ref->base = obj;
- insert_ref_hash(ref);
+ insert_ref_hash(ref, refs_hash, refs_hash_size);
nr_object_refs = nr;
}
^ permalink raw reply related
* Re: Odd behavior with git and cairo-devel repo
From: Junio C Hamano @ 2006-06-21 19:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andre Noll, Art Haas, git
In-Reply-To: <Pine.LNX.4.64.0606211054500.5498@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> Ouch.
Ouch indeed ;-).
> Actually, the alternate patch is the one I had intended to do but for some
> reasons didn't.
>
> This one also removes two more lines than it adds, but it's obviously a
> bigger patch.
I'll take this, since I think keeping the hash population
(collision maintenance) code in one place like your version does
seems cleaner for me to read three months down the road.
Again, thanks Andre, Art and Linus.
^ permalink raw reply
* Re: [RFC] gitweb wishlist and TODO list
From: Josef Weidendorfer @ 2006-06-21 20:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <200606211838.50864.jnareb@gmail.com>
On Wednesday 21 June 2006 18:38, you wrote:
> Josef Weidendorfer wrote:
> > Let's see. A think a mixture between current history and log...
> > Currently, it looks like this
> >
> > http://git.kernel.org/git/?p=git/git.git;a=history;f=Documentation
> >
> > gives you the history of subdirectory Documentation/ of git
> > (unfortunately only reachable via changing the URL...).
> >
> > And it could look as attached (I did a little copy/paste of
> > HTML). I only modified 2 commits of the list...
>
> It probably didn't get to mailing list (at least to archives) due
> to having attachement.
Yes; the mailing list regarded as spam because of the attachment.
> I thought you wanted to enhance tree view,
That wasn't me ;-)
> e.g. adding to the view like in
>
> http://git.kernel.org/git/?p=git/git.git;a=tree;f=Documentation
>
> columns 'Changed by' or 'Author', 'Age' or 'Last changed', 'Commit'
> (i.e. abbreviated sha1 id of a commit), and perhaps shortened commit
> message (short description of changes, a la shortlog but shorther).
Yes, sometimes this could be interesting. However, as said above,
I find myself often looking for date sorting with such views.
> In other words 'blame'/'annotate' for directory. Which would need new git
> command I think.
Hmmm... wouldn't "git-log --summary", and building up a map from files names
to commits be enough? You would probably need to parse the full history before
sending any output, so it is potentially heavy.
> Adding filtered list of files modified by commit in log and history views
> should be fairly easy...
Yes. If I get some time, I'll send a patch.
Josef
^ permalink raw reply
* Re: [PATCH] Check and document the options to prevent mistakes.
From: Junio C Hamano @ 2006-06-21 20:53 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: git
In-Reply-To: <m164iu8x78.fsf@ebiederm.dsl.xmission.com>
ebiederm@xmission.com (Eric W. Biederman) writes:
> +# Verify the user input
> +
> +foreach my $entry (@to) {
> + die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
> +}
> +
Perhaps, avoiding double negation would be easier on the eyes.
die ... if $entry =~ /,/
Does it grok '"Biederman, Eric W." <eb@xm.com>' some people seem
to do properly, or do we care (I personally don't)?
^ permalink raw reply
* [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed
From: Jakub Narebski @ 2006-06-21 22:42 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
For commits in oneline view (summary, shortlog, history) commit title
(first line of commit message) is link to commit itself. If commit title
(commit description) is shortened in output, hyperlink has title attribute
with full title.
This commit does the same also for tags. It is much more rare to have long
tag description, though.
Misfeature: sometimes tag link has title attribute even if tag description
doesn't seem to be shortened.
Needs refactoring (twice done almost exactly the same, four times similar
code is used).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
e41a09e140c1ecd933ae90e7b55660d67f33dc1b
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..8f8ae4a 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -326,7 +326,7 @@ EOF
} elsif (defined $hash) {
$search_hash = $hash;
} else {
- $search_hash = "HEAD";
+ $search_hash = "HEAD";
}
$cgi->param("a", "search");
$cgi->param("h", $search_hash);
@@ -1107,7 +1107,8 @@ sub git_summary {
foreach my $entry (@$taglist) {
my %tag = %$entry;
my $comment_lines = $tag{'comment'};
- my $comment = shift @$comment_lines;
+ my $comment_long = shift @$comment_lines;
+ my $comment = $comment_long;
if (defined($comment)) {
$comment = chop_str($comment, 30, 5);
}
@@ -1119,13 +1120,17 @@ sub git_summary {
$alternate ^= 1;
if ($i-- > 0) {
print "<td><i>$tag{'age'}</i></td>\n" .
- "<td>" .
+ "<td>";
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
"<b>" . esc_html($tag{'name'}) . "</b>") .
"</td>\n" .
"<td>";
if (defined($comment)) {
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ if (length($comment) < length($comment_long)) {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), -title => "$comment_long"}, $comment);
+ } else {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ }
}
print "</td>\n" .
"<td class=\"link\">";
@@ -1346,7 +1351,8 @@ sub git_tags {
foreach my $entry (@$taglist) {
my %tag = %$entry;
my $comment_lines = $tag{'comment'};
- my $comment = shift @$comment_lines;
+ my $comment_long = shift @$comment_lines;
+ my $comment = $comment_long;
if (defined($comment)) {
$comment = chop_str($comment, 30, 5);
}
@@ -1363,7 +1369,11 @@ sub git_tags {
"</td>\n" .
"<td>";
if (defined($comment)) {
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ if (length($comment) < length($comment_long)) {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), -title => "$comment_long"}, $comment);
+ } else {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ }
}
print "</td>\n" .
"<td class=\"link\">";
--
1.3.0
^ permalink raw reply related
* Re: [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed
From: Junio C Hamano @ 2006-06-21 23:10 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <11509297422173-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> For commits in oneline view (summary, shortlog, history) commit title
> (first line of commit message) is link to commit itself. If commit title
> (commit description) is shortened in output, hyperlink has title attribute
> with full title.
There are pure fixes and this "-title" enhancement intermixed.
Can we have fixes-only first?
> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
> index e044c61..8f8ae4a 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.cgi
> @@ -326,7 +326,7 @@ EOF
> } elsif (defined $hash) {
> $search_hash = $hash;
> } else {
> - $search_hash = "HEAD";
> + $search_hash = "HEAD";
> }
> $cgi->param("a", "search");
> $cgi->param("h", $search_hash);
Is a fix.
> @@ -1107,7 +1107,8 @@ sub git_summary {
> foreach my $entry (@$taglist) {
> my %tag = %$entry;
> my $comment_lines = $tag{'comment'};
> - my $comment = shift @$comment_lines;
> + my $comment_long = shift @$comment_lines;
> + my $comment = $comment_long;
> if (defined($comment)) {
> $comment = chop_str($comment, 30, 5);
> }
Is an enhancement.
> @@ -1119,13 +1120,17 @@ sub git_summary {
> $alternate ^= 1;
> if ($i-- > 0) {
> print "<td><i>$tag{'age'}</i></td>\n" .
> - "<td>" .
> + "<td>";
> $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
> "<b>" . esc_html($tag{'name'}) . "</b>") .
> "</td>\n" .
> "<td>";
Is a fix. How could we have missed this?
> if (defined($comment)) {
> - print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
> + if (length($comment) < length($comment_long)) {
> + print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), -title => "$comment_long"}, $comment);
> + } else {
> + print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
> + }
> }
> print "</td>\n" .
> "<td class=\"link\">";
Is an enhancement -- I suspect it is not worth to switch
depending on the length of $comment_long. Does it clutter the
output too much if you did -title to everybody?
> @@ -1346,7 +1351,8 @@ sub git_tags {
> foreach my $entry (@$taglist) {
> my %tag = %$entry;
> my $comment_lines = $tag{'comment'};
> - my $comment = shift @$comment_lines;
> + my $comment_long = shift @$comment_lines;
> + my $comment = $comment_long;
> if (defined($comment)) {
> $comment = chop_str($comment, 30, 5);
> }
Is an enhancement. I think the matching hunk to fix the same
"$cgi->a() output concatenated as print argument" problem is
missing here. And the next hunk the same comment as the one for
git_summary applies.
And as you say, git_summary and git_tags do look similar. Maybe
we would want to refactor them first to clean things up before
piling up more features?
^ permalink raw reply
* Re: [PATCH 4/4] upload-pack/fetch-pack: support side-band communication
From: Junio C Hamano @ 2006-06-22 0:17 UTC (permalink / raw)
To: git; +Cc: Jon Loeliger
In-Reply-To: <7vsllyzs9w.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> This implements a protocol extension between fetch-pack and
> upload-pack to allow stderr stream from upload-pack (primarily
> used for the progress bar display) to be passed back.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> ---
>
> * With this, fetching and cloning over git+ssh:// and git://
> does not discard the progress bar and error messages that
> upload-pack emits on its standard output. They are sent to
> the downloader and shown to the user.
>
> Somehow this does not work when connecting to git daemon that
> runs under inetd. Fixes appreciated.
This seems to fix it.
-- >8 --
Subject: [PATCH] daemon: send stderr to /dev/null instead of closing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
daemon.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemon.c b/daemon.c
index bdfe80d..0747ce2 100644
--- a/daemon.c
+++ b/daemon.c
@@ -757,7 +757,7 @@ int main(int argc, char **argv)
struct sockaddr *peer = (struct sockaddr *)&ss;
socklen_t slen = sizeof(ss);
- fclose(stderr); //FIXME: workaround
+ freopen("/dev/null", "w", stderr);
if (getpeername(0, peer, &slen))
peer = NULL;
--
1.4.0.g7883
^ permalink raw reply related
* Re: gitk lower pane (commit and files view) scrollbar extends past gitk window
From: Edgar Toernig @ 2006-06-22 0:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <e7ber7$qh9$1@sea.gmane.org>
Jakub Narebski wrote:
>
> In gitk from the current 'next' branch, post git version 1.4.0
> (blob ba4644f) scrollbar for lower pane, i.e. for commitdiff and files
> (Comments) views extends past the bottom of the gitk window. Therefore
> I cannnot see lower part of commit diff if it is larger than window height.
Yes, and the search field at the bottom is invisible too. Removing
line 431:
.ctop conf -width $geometry(width) -height $geometry(height)
seems to fix it and the window still gets the right size.
Ciao, ET.
^ permalink raw reply
* [PATCH] [RFC] Introduce Git.pm
From: Petr Baudis @ 2006-06-22 0:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will expand it in the next days.
Most desirable now is proper error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.
Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. And things will get much more interesting
when we get to XS-izing libgit.
This adds the Git.pm, integrates it to the build system and as an example
converts the git-fmt-merge-msg.perl script to it (the result is not very
impressive since its advantage is not quite apparent in this one, but I
just picked up the simplest Git user around).
This is mostly to show up what I have so far and gather some comments
on the general shapes of the interface; I guess in the current shape
of the API it's suitable for pu at best, but that's not my call.
My current working state is available all the time at
http://pasky.or.cz/~xpasky/git-perl/Git.pm
and an irregularily updated API documentation is at
http://pasky.or.cz/~xpasky/git-perl/Git.html
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
Makefile | 13 ++
git-fmt-merge-msg.perl | 9 +-
perl/Git.pm | 284 ++++++++++++++++++++++++++++++++++++++++++++++++
perl/Makefile.PL | 14 ++
4 files changed, 314 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 0887945..59eca6d 100644
--- a/Makefile
+++ b/Makefile
@@ -479,7 +479,8 @@ ### Build rules
all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
-all:
+all: perl/Makefile
+ $(MAKE) -C perl
$(MAKE) -C templates
strip: $(PROGRAMS) git$X
@@ -511,7 +512,7 @@ common-cmds.h: Documentation/git-*.txt
$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
rm -f $@ $@+
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+ sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1 -I'"$$(make -s -C perl instlibdir)"'|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.perl >$@+
chmod +x $@+
@@ -599,6 +600,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
+perl/Makefile: perl/Git.pm perl/Makefile.PL
+ (cd perl && $(PERL_PATH) Makefile.PL PREFIX="$(prefix)")
+
doc:
$(MAKE) -C Documentation all
@@ -618,6 +622,7 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
@FLAGS='$(TRACK_CFLAGS)'; \
if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
echo 1>&2 " * new build flags or prefix"; \
+ echo 1>&2 " * $$FLAGS != `cat GIT-CFLAGS 2>/dev/null`"; \
echo "$$FLAGS" >GIT-CFLAGS; \
fi
@@ -654,6 +659,7 @@ install: all
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates install
+ $(MAKE) -C perl install
$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
@@ -721,7 +727,8 @@ clean:
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
rm -f $(htmldocs).tar.gz $(manpages).tar.gz
$(MAKE) -C Documentation/ clean
- $(MAKE) -C templates clean
+ [ ! -e perl/Makefile ] || $(MAKE) -C perl/ clean
+ $(MAKE) -C templates/ clean
$(MAKE) -C t/ clean
rm -f GIT-VERSION-FILE GIT-CFLAGS
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 5986e54..a2da46e 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -6,6 +6,9 @@ # Read .git/FETCH_HEAD and make a human
# by grouping branches and tags together to form a single line.
use strict;
+use Git;
+
+my $repo = Git->repository();
my @src;
my %src;
@@ -28,12 +31,12 @@ sub andjoin {
}
sub repoconfig {
- my ($val) = qx{git-repo-config --get merge.summary};
+ my ($val) = $repo->generic_oneline('repo-config', '--get', 'merge.summary');
return $val;
}
sub current_branch {
- my ($bra) = qx{git-symbolic-ref HEAD};
+ my ($bra) = $repo->generic_oneline('symbolic-ref', 'HEAD');
chomp($bra);
$bra =~ s|^refs/heads/||;
if ($bra ne 'master') {
@@ -47,7 +50,7 @@ sub current_branch {
sub shortlog {
my ($tip) = @_;
my @result;
- foreach ( qx{git-log --no-merges --topo-order --pretty=oneline $tip ^HEAD} ) {
+ foreach ($repo->generic('log', '--no-merges', '--topo-order', '--pretty=oneline', $tip, '^HEAD')) {
s/^[0-9a-f]{40}\s+//;
push @result, $_;
}
diff --git a/perl/Git.pm b/perl/Git.pm
new file mode 100644
index 0000000..2f968c5
--- /dev/null
+++ b/perl/Git.pm
@@ -0,0 +1,284 @@
+=head1 NAME
+
+Git - Perl interface to the Git version control system
+
+=cut
+
+
+package Git;
+
+use strict;
+
+use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK);
+
+# Totally unstable API.
+$VERSION = "0.0.1";
+
+
+=head1 SYNOPSIS
+
+ use Git;
+
+ my $version = Git::generic_oneval('version');
+
+ Git::generic_vocal('update-server-info');
+
+ my $repo = Git->repository (Directory => '/srv/git/cogito.git');
+
+
+ my @revs = $repo->generic('rev-list', '--since=last monday', '--all');
+
+ my $fh = $repo->generic('rev-list', '--since=last monday', '--all');
+ my $lastrev = <$fh>; chomp $lastrev;
+ close $fh;
+
+ my $lastrev = $repo->generic_oneval('rev-list', '--all');
+
+=cut
+
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = qw();
+
+# Methods which can be called as standalone functions as well:
+@EXPORT_OK = qw(generic generic_oneval generic_vocal);
+
+
+=head1 DESCRIPTION
+
+This module provides Perl scripts easy way to interface the Git version control
+system. The modules have an easy and well-tested way to call arbitrary Git
+commands; in the future, the interface will also provide specialized methods
+for doing easily operations which are not totally trivial to do over the generic
+interface.
+
+While some commands can be executed outside of any context (e.g. 'version'
+or 'init-db'), most operations require a repository context, which in practice
+means getting an instance of the Git object using the repository() constructor.
+(In the future, we will also get a new_repository() constructor.) All commands
+called as methods of the object are then executed in the context of the
+repository.
+
+TODO: In the future, we might also do
+
+ my $subdir = $repo->subdir('Documentation');
+ # Gets called in the subdirectory context:
+ $subdir->generic('status');
+
+ my $remoterepo = $repo->remote_repository (name => 'cogito', branch => 'master');
+ $remoterepo ||= Git->remote_repository ('http://git.or.cz/cogito.git/');
+ my @refs = $remoterepo->refs();
+
+So far, all functions just die if anything goes wrong. If you don't want that,
+make appropriate provisions to catch the possible deaths. Better error recovery
+mechanisms will be provided in the future.
+
+Currently, the module merely wraps calls to external Git tools. In the future,
+it will provide a much faster way to interact with Git by linking directly
+to libgit. This should be completely opaque to the user, though (performance
+increate nonwithstanding).
+
+=cut
+
+
+use IPC::Open3;
+
+
+=head1 CONSTRUCTORS
+
+=over 4
+
+=item repository ( OPTIONS )
+
+=item repository ( DIRECTORY )
+
+=item repository ()
+
+Construct a new repository object.
+C<OPTIONS> are passed in a hash like fashion, using key and value pairs.
+Possible options are:
+
+B<Repository> - Path to the Git repository.
+
+B<WorkingCopy> - Path to the associated working copy; not strictly required
+as many commands will happily crunch on a bare repository.
+
+B<Directory> - Path to the Git working directory in its usual setup. This
+is just for convenient setting of both C<Repository> and C<WorkingCopy>
+at once: If the directory as a C<.git> subdirectory, C<Repository> is pointed
+to the subdirectory and the directory is assumed to be the working copy.
+If the directory does not have the subdirectory, C<WorkingCopy> is left
+undefined and C<Repository> is pointed to the directory itself.
+
+You should not use both C<Directory> and either of C<Repository> and
+C<WorkingCopy> - the results of that are undefined.
+
+Alternatively, a directory path may be passed as a single scalar argument
+to the constructor; it is equivalent to setting only the C<Directory> option
+field.
+
+Calling the constructor with no options whatsoever is equivalent to
+calling it with C<< Directory => '.' >>.
+
+=cut
+
+sub repository {
+ my $class = shift;
+ my @args = @_;
+ my %opts = ();
+ my $self;
+
+ if (defined $args[0]) {
+ if ($#args % 2 != 1) {
+ # Not a hash.
+ $#args == 0 or die "Git::repository(): bad usage";
+ %opts = (Directory => $args[0]);
+ } else {
+ %opts = @args;
+ }
+
+ if ($opts{Directory}) {
+ -d $opts{Directory} or die "Git::repository($opts{Directory}): $!";
+ if (-d $opts{Directory}."/.git") {
+ # TODO: Might make this more clever
+ $opts{WorkingCopy} = $opts{Directory};
+ $opts{Repository} = $opts{Directory}."/.git";
+ } else {
+ $opts{Repository} = $opts{Directory};
+ }
+ delete $opts{Directory};
+ }
+ }
+
+ $self = { opts => \%opts };
+ bless $self, $class;
+}
+
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item generic ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given Git C<COMMAND> (specify it without the 'git-'
+prefix), optionally with the specified extra C<ARGUMENTS>. The method can be
+called without any instance or on a specified Git repository.
+
+In scalar context, it returns a filehandle containing the command output.
+
+In array context, it returns an array containing lines printed to the
+command's stdout.
+
+In both cases, the command's stdin and stderr are the same as the caller's.
+
+=cut
+
+sub generic {
+ my ($self, $cmd, @args) = _maybe_self(@_);
+
+ $cmd =~ /^[a-z0-9A-Z_-]+$/ or die "bad command: $cmd";
+
+ my $pid = open(my $fh, "-|");
+ if ($pid < 0) {
+ die "generic($cmd, @args) open: $!";
+ } elsif ($pid == 0) {
+ _do_exec($self, $cmd, @args);
+ }
+
+ return $fh unless wantarray;
+
+ my @lines = <$fh>;
+ close $fh;
+ chomp @lines;
+ return @lines;
+}
+
+=item generic_oneline ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as generic()
+does but always return a scalar string containing the first line
+of the command's standard output.
+
+=cut
+
+sub generic_oneline {
+ my $fh = generic(@_);
+ my $line = <$fh>;
+ close $fh;
+ chomp $line;
+ return $line;
+}
+
+=item generic_vocal ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as generic() does but does not
+capture the command output - the standard output is not redirected and goes
+to the standard output of the caller application.
+
+While the method is called generic_vocal(), you might want to as well use
+it for the most silent Git commands which you know will never pollute your
+stdout but you want to avoid the overhead of the pipe setup when calling them.
+
+The function returns only after the command has finished running.
+
+=cut
+
+sub generic_vocal {
+ my ($self, $cmd, @args) = _maybe_self(@_);
+
+ $cmd =~ /^[a-z0-9A-Z_-]+$/ or die "bad command: $cmd";
+
+ my $pid = fork;
+ if ($pid < 0) {
+ die "generic_vocal($cmd, @args) fork: $!";
+ } elsif ($pid == 0) {
+ _do_exec($self, $cmd, @args);
+ }
+ waitpid($pid, 0);
+}
+
+
+=back
+
+=head1 TODO
+
+This is still fairly crude. Repository objects not yet supported.
+We need some good way to report errors back except just dying.
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Petr Baudis E<lt>pasky@suse.czE<gt>.
+
+This module is free software; it may be used, copied, modified
+and distributed under the terms of the GNU General Public Licence,
+either version 2, or (at your option) any later version.
+
+=cut
+
+
+# Takes raw method argument list and returns ($obj, @args) in case
+# the method was called upon an instance and (undef, @args) if
+# it was called directly.
+sub _maybe_self {
+ # This breaks inheritance. Oh well.
+ ref $_[0] eq 'Git' ? @_ : (undef, @_);
+}
+
+# When already in the subprocess, set up the appropriate state
+# for the given repository and execute the git command.
+sub _do_exec {
+ my ($self, @args) = @_;
+ if ($self) {
+ $self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
+ $self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
+ }
+ exec ('git', @args) or die "Git exec: $!";
+}
+
+1; # Famous final words
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
new file mode 100644
index 0000000..703ea98
--- /dev/null
+++ b/perl/Makefile.PL
@@ -0,0 +1,14 @@
+use ExtUtils::MakeMaker;
+
+sub MY::postamble {
+ return <<'MAKE_FRAG';
+instlibdir:
+ @echo $(INSTALLSITELIB)
+
+MAKE_FRAG
+}
+
+WriteMakefile(
+ NAME => 'Git',
+ VERSION_FROM => 'Git.pm'
+);
^ permalink raw reply related
* Re: [PATCH] [RFC] Introduce Git.pm
From: Junio C Hamano @ 2006-06-22 1:03 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20060622003546.17760.23089.stgit@machine.or.cz>
Petr Baudis <pasky@suse.cz> writes:
> Currently Git.pm just wraps up exec()s of Git commands, but even that
> is not trivial to get right and various Git perl scripts do it in
> various inconsistent ways. And things will get much more interesting
> when we get to XS-izing libgit.
We would probably need some moderate to major surgery before
doing that depending on which parts. Worrisome are object layer
that holds onto parsed objects and keeps flag bits from the
previous runs, and lockfile that are cleaned up via atexit() --
there may be others.
> @@ -618,6 +622,7 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
> @FLAGS='$(TRACK_CFLAGS)'; \
> if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
> echo 1>&2 " * new build flags or prefix"; \
> + echo 1>&2 " * $$FLAGS != `cat GIT-CFLAGS 2>/dev/null`"; \
> echo "$$FLAGS" >GIT-CFLAGS; \
> fi
>
Offtopic; do people mind if we drop $GIT_VERSION from
TRACK_CFLAGS? Every time I switch branches or make a new commit
it ends up rebuilding everything needlessly.
> sub current_branch {
> - my ($bra) = qx{git-symbolic-ref HEAD};
> + my ($bra) = $repo->generic_oneline('symbolic-ref', 'HEAD');
> chomp($bra);
> $bra =~ s|^refs/heads/||;
> if ($bra ne 'master') {
Your *_oneline chomps so chomp($bra) is not needed anymore, I think.
In any case, this is an excellent move to clean things up.
Various implementations of qx{} will be all in one place so
ActiveState folks would have easier time adjusting things to
their environment.
> +require Exporter;
Not "use"?
> +# Methods which can be called as standalone functions as well:
> +@EXPORT_OK = qw(generic generic_oneval generic_vocal);
I am not sure generic_xxx is a good name. Perhaps command_xxx?
Also as you say in the comment, "vocal" sounds a bit funny.
I wonder if we can use wantarray to detect the case where the
caller wants _no_ value, and do the "not piping" optimization in
that case.
^ permalink raw reply
* [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
From: Yakov Lerner @ 2006-06-22 1:47 UTC (permalink / raw)
To: git; +Cc: iler.ml
Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
command line to all and every %c compiled. In fact the macro
is used by only one .c file, and unused by all other .c files.
Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of
exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index c602099..7af0937 100644
--- a/Makefile
+++ b/Makefile
@@ -472,7 +472,6 @@ PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON
GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR))
ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
-ALL_CFLAGS += -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
LIB_OBJS += $(COMPAT_OBJS)
export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
### Build rules
@@ -548,6 +547,8 @@ git$X git.spec \
exec_cmd.o: exec_cmd.c GIT-CFLAGS
$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
+builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
+ $(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
http.o: http.c GIT-CFLAGS
$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
--
1.4.0.ga40a
^ permalink raw reply related
* Re: [PATCH] [RFC] Introduce Git.pm
From: Eric Wong @ 2006-06-22 2:31 UTC (permalink / raw)
To: Petr Baudis; +Cc: Junio C Hamano, git
In-Reply-To: <20060622003546.17760.23089.stgit@machine.or.cz>
Petr Baudis <pasky@suse.cz> wrote:
> Currently Git.pm just wraps up exec()s of Git commands, but even that
> is not trivial to get right and various Git perl scripts do it in
> various inconsistent ways. And things will get much more interesting
> when we get to XS-izing libgit.
git-svn uses fork/pipe/exec very heavily for both reads and writes and
also a few bidirectional cases, as well. It would be good exercise to
port it to use Git.pm once it's more complete and stable.
XS-ising libgit would be awesome with all the git-hash-object calls in
git-svn (and other importers, too, I imagine).
> This is mostly to show up what I have so far and gather some comments
> on the general shapes of the interface; I guess in the current shape
> of the API it's suitable for pu at best, but that's not my call.
safe_qx (git-svn) AKA safe_pipe_capture (archimport) would be
non-git-specific, but very useful.
> + my $pid = open(my $fh, "-|");
> + if ($pid < 0) {
> + die "generic($cmd, @args) open: $!";
In Perl, fork returns undef instead of $pid < 0 on failure. Doing
join(' ',@args) will also make the error message more readable, too :)
--
Eric Wong
^ permalink raw reply
* Re: [PATCH] Check and document the options to prevent mistakes.
From: Eric W. Biederman @ 2006-06-22 3:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7vqxmb7.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> ebiederm@xmission.com (Eric W. Biederman) writes:
>
>> +# Verify the user input
>> +
>> +foreach my $entry (@to) {
>> + die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
>> +}
>> +
>
> Perhaps, avoiding double negation would be easier on the eyes.
>
> die ... if $entry =~ /,/
Sure double negation does get confusing. I think I forgot about that
last if form. My perl is rusty from disuse.
> Does it grok '"Biederman, Eric W." <eb@xm.com>' some people seem
> to do properly, or do we care (I personally don't)?
Nope. If figure that is lesser of two evils. If I could properly
grok that I would make it do things properly and parse a --cc
option for multiple email addresses.
I think you can still specify those interesting forms in an alias
file, like .mailrc.
The important thing is not to do a mailing and the discover your
recipients didn't get the email.
Eric
^ permalink raw reply
* Re: [PATCH] Check and document the options to prevent mistakes.
From: Junio C Hamano @ 2006-06-22 3:45 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: git
In-Reply-To: <m1irmt6gax.fsf@ebiederm.dsl.xmission.com>
ebiederm@xmission.com (Eric W. Biederman) writes:
> Junio C Hamano <junkio@cox.net> writes:
>
>> Does it grok '"Biederman, Eric W." <eb@xm.com>' some people seem
>> to do properly, or do we care (I personally don't)?
>
> Nope. If figure that is lesser of two evils.
Fair enough.
^ permalink raw reply
* [PATCH] gitweb: whitespace cleanup around '='
From: Jakub Narebski @ 2006-06-22 6:52 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20060622023546.28cb4291.froese@gmx.de>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
82c8812870e9c40fd495e9c3e2eae0eb78ac2759
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..adc4a42 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -326,7 +326,7 @@ EOF
} elsif (defined $hash) {
$search_hash = $hash;
} else {
- $search_hash = "HEAD";
+ $search_hash = "HEAD";
}
$cgi->param("a", "search");
$cgi->param("h", $search_hash);
@@ -1766,8 +1766,8 @@ sub git_opml {
}
my $path = esc_html(chop_str($proj{'path'}, 25, 5));
- my $rss = "$my_url?p=$proj{'path'};a=rss";
- my $html = "$my_url?p=$proj{'path'};a=summary";
+ my $rss = "$my_url?p=$proj{'path'};a=rss";
+ my $html = "$my_url?p=$proj{'path'};a=summary";
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
}
print "</outline>\n".
@@ -1942,7 +1942,7 @@ sub git_commit {
"<td class=\"link\">" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
"</td>" .
"</tr>\n";
- my $parents = $co{'parents'};
+ my $parents = $co{'parents'};
foreach my $par (@$parents) {
print "<tr>" .
"<td>parent</td>" .
--
1.3.0
^ permalink raw reply related
* Re: [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed
From: Jakub Narebski @ 2006-06-22 6:54 UTC (permalink / raw)
To: git
In-Reply-To: <7vu06exfym.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> For commits in oneline view (summary, shortlog, history) commit title
>> (first line of commit message) is link to commit itself. If commit title
>> (commit description) is shortened in output, hyperlink has title attribute
>> with full title.
>
> There are pure fixes and this "-title" enhancement intermixed.
> Can we have fixes-only first?
O.K. done.
> And as you say, git_summary and git_tags do look similar. Maybe
> we would want to refactor them first to clean things up before
> piling up more features?
O.K. will do.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] gitweb: whitespace cleanup around '='
From: Jakub Narebski @ 2006-06-22 7:01 UTC (permalink / raw)
To: git
In-Reply-To: <11509591773212-git-send-email-jnareb@gmail.com>
I'm sorry, wrong In-Reply-To given to git-send-email.
It should be reply to <7vu06exfym.fsf@assigned-by-dhcp.cox.net>
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] gitweb: whitespace cleanup around '='
From: Junio C Hamano @ 2006-06-22 7:09 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <11509591773212-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> @@ -326,7 +326,7 @@ EOF
> } elsif (defined $hash) {
> $search_hash = $hash;
> } else {
> - $search_hash = "HEAD";
> + $search_hash = "HEAD";
> }
> $cgi->param("a", "search");
> $cgi->param("h", $search_hash);
My copy from "next" has this part like the following:
if (!defined $searchtext) {
$searchtext = "";
}
my $search_hash;
if (defined $hash) {
$search_hash = $hash;
} else {
$search_hash = "HEAD";
}
I thought we were both reasonably sure that we are now in
sync... I could apply it by hand but once I start doing that
I'm afraid we will never converge.
It's quite frustrating.
> @@ -1766,8 +1766,8 @@ sub git_opml {
> }
>
> my $path = esc_html(chop_str($proj{'path'}, 25, 5));
> - my $rss = "$my_url?p=$proj{'path'};a=rss";
> - my $html = "$my_url?p=$proj{'path'};a=summary";
> + my $rss = "$my_url?p=$proj{'path'};a=rss";
> + my $html = "$my_url?p=$proj{'path'};a=summary";
> print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
> }
> print "</outline>\n".
Are you sure you want to do "my $rss two-spaces equal space"?
I've fixed up the whitespace you missed and will be applying the
following on top of what is in "next" tonight.
-- >8 --
gitweb: do not align assignment = with extra whitespaces
---
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index f2e5046..e2ed6db 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -55,7 +55,7 @@ my $projects_list = "index/index.aux";
# default blob_plain mimetype and default charset for text/plain blob
my $default_blob_plain_mimetype = 'text/plain';
-my $default_text_plain_charset = undef;
+my $default_text_plain_charset = undef;
# file to use for guessing MIME types before trying /etc/mime.types
# (relative to the current git repository)
@@ -325,7 +325,7 @@ EOF
if (defined $hash) {
$search_hash = $hash;
} else {
- $search_hash = "HEAD";
+ $search_hash = "HEAD";
}
$cgi->param("a", "search");
$cgi->param("h", $search_hash);
@@ -1283,21 +1283,21 @@ HTML
if ($line =~ m/^([0-9a-fA-F]{40})\t\(\s*([^\t]+)\t(\d+) \+\d\d\d\d\t(\d+)\)(.*)$/) {
$long_rev = $1;
- $author = $2;
- $time = $3;
- $lineno = $4;
- $data = $5;
+ $author = $2;
+ $time = $3;
+ $lineno = $4;
+ $data = $5;
} else {
print qq( <tr><td colspan="5" class="error">Unable to parse: $line</td></tr>\n);
next;
}
- $short_rev = substr ($long_rev, 0, 8);
- $age = time () - $time;
- $age_str = age_string ($age);
- $age_str =~ s/ / /g;
- $age_class = age_class($age);
- $author = esc_html ($author);
- $author =~ s/ / /g;
+ $short_rev = substr ($long_rev, 0, 8);
+ $age = time () - $time;
+ $age_str = age_string ($age);
+ $age_str =~ s/ / /g;
+ $age_class = age_class($age);
+ $author = esc_html ($author);
+ $author =~ s/ / /g;
# escape tabs
while ((my $pos = index($data, "\t")) != -1) {
if (my $count = (8 - ($pos % 8))) {
@@ -1765,8 +1765,8 @@ sub git_opml {
}
my $path = esc_html(chop_str($proj{'path'}, 25, 5));
- my $rss = "$my_url?p=$proj{'path'};a=rss";
- my $html = "$my_url?p=$proj{'path'};a=summary";
+ my $rss = "$my_url?p=$proj{'path'};a=rss";
+ my $html = "$my_url?p=$proj{'path'};a=summary";
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
}
print "</outline>\n".
@@ -1941,7 +1941,7 @@ sub git_commit {
"<td class=\"link\">" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
"</td>" .
"</tr>\n";
- my $parents = $co{'parents'};
+ my $parents = $co{'parents'};
foreach my $par (@$parents) {
print "<tr>" .
"<td>parent</td>" .
^ permalink raw reply related
* Re: gitk lower pane (commit and files view) scrollbar extends past gitk window
From: Alex Riesen @ 2006-06-22 7:10 UTC (permalink / raw)
To: Edgar Toernig; +Cc: Jakub Narebski, git, Paul Mackerras
In-Reply-To: <20060622023546.28cb4291.froese@gmx.de>
On 6/22/06, Edgar Toernig <froese@gmx.de> wrote:
> Jakub Narebski wrote:
> >
> > In gitk from the current 'next' branch, post git version 1.4.0
> > (blob ba4644f) scrollbar for lower pane, i.e. for commitdiff and files
> > (Comments) views extends past the bottom of the gitk window. Therefore
> > I cannnot see lower part of commit diff if it is larger than window height.
>
> Yes, and the search field at the bottom is invisible too. Removing
> line 431:
>
> .ctop conf -width $geometry(width) -height $geometry(height)
>
> seems to fix it and the window still gets the right size.
>
No, it does not. It gets the default geometry, not the one it had last time.
^ permalink raw reply
* Re: [PATCH] [RFC] Introduce Git.pm
From: Alex Riesen @ 2006-06-22 7:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Petr Baudis, git
In-Reply-To: <7v64iuxard.fsf@assigned-by-dhcp.cox.net>
On 6/22/06, Junio C Hamano <junkio@cox.net> wrote:
> Offtopic; do people mind if we drop $GIT_VERSION from
> TRACK_CFLAGS? Every time I switch branches or make a new commit
> it ends up rebuilding everything needlessly.
Me too. That's one of the you're too lazy to report, because you
think: "it is not yet annoying enough".
^ permalink raw reply
* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
From: Junio C Hamano @ 2006-06-22 7:19 UTC (permalink / raw)
To: Yakov Lerner; +Cc: git
In-Reply-To: <0J1800MC1NKJD2C0@mxout2.netvision.net.il>
Yakov Lerner <iler.ml@gmail.com> writes:
> Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
> command line to all and every %c compiled. In fact the macro
> is used by only one .c file, and unused by all other .c files.
> Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of
> exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
Thanks.
By the way, I really started hating that we have $(GIT_VERSION)
in $(TRACK_CFLAGS). Since the version string is tied to the
HEAD commit object name, having it in $(TRACK_CFLAGS) means that
every time I switch branches, make a new commit on top of the
current branch, or checkout-compile-and-then-make-local-change
sequence would force pretty much everything to be rebuilt.
Do you think of any downside if I remove it from the list of
symbols in TRACK_CFLAGS?
For that matter, I do not think tracking prefix_SQ makes much
sense since what matters are bindir, gitexecdir and template_dir
which are already covered, and prefix is merely a convenience to
set these three (four, counting GIT_PYTHON_DIR; we probably
should add it to TRACK_CFLAGS).
Thoughts?
^ permalink raw reply
* Re: [PATCH] gitweb: whitespace cleanup around '='
From: Jakub Narebski @ 2006-06-22 7:32 UTC (permalink / raw)
To: git
In-Reply-To: <7vejxhwts4.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> @@ -326,7 +326,7 @@ EOF
>> } elsif (defined $hash) {
>> $search_hash = $hash;
>> } else {
>> - $search_hash = "HEAD";
>> + $search_hash = "HEAD";
>> }
>> $cgi->param("a", "search");
>> $cgi->param("h", $search_hash);
>
> My copy from "next" has this part like the following:
>
> if (!defined $searchtext) {
> $searchtext = "";
> }
> my $search_hash;
> if (defined $hash) {
> $search_hash = $hash;
> } else {
> $search_hash = "HEAD";
> }
>
> I thought we were both reasonably sure that we are now in
> sync... I could apply it by hand but once I start doing that
> I'm afraid we will never converge.
>
> It's quite frustrating.
I'm very sorry, I forgot that I applied Timo Hirvonen patch
"[PATCH] gitweb: Start search from HEAD"
(<20060620152515.23e59396.tihirvon@gmail.com>)
http://permalink.gmane.org/gmane.comp.version-control.git/22197>
on top of 'next'.
This patch fixes search quite nicely, reducing significantly number of error
messages during search (e.g. starting search from blob or file view).
Any reason not to apply it?
>> my $path = esc_html(chop_str($proj{'path'}, 25, 5));
>> - my $rss = "$my_url?p=$proj{'path'};a=rss";
>> - my $html = "$my_url?p=$proj{'path'};a=summary";
>> + my $rss = "$my_url?p=$proj{'path'};a=rss";
>> + my $html = "$my_url?p=$proj{'path'};a=summary";
>
> Are you sure you want to do "my $rss two-spaces equal space"?
>
> I've fixed up the whitespace you missed and will be applying the
> following on top of what is in "next" tonight.
>
> -- >8 --
> gitweb: do not align assignment = with extra whitespaces
My idea for coding style is to align assignment = with extra whitespaces,
but only where aligned assignments statements are one after another.
The above "my $rss" example was mistyped as " = " instead of " = ",
but I think it was meant to be aligned at '='. IMHO aligning at assign
makes code more readable.
But that is just my opinion.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [WORKAROUND] gitk lower pane scrollbar extends past gitk window
From: Jakub Narebski @ 2006-06-22 7:48 UTC (permalink / raw)
To: git
In-Reply-To: <81b0412b0606220010p6c2e62ffv3914abafd95e4bb2@mail.gmail.com>
Alex Riesen wrote:
> On 6/22/06, Edgar Toernig <froese@gmx.de> wrote:
>> Jakub Narebski wrote:
>>>
>>> In gitk from the current 'next' branch, post git version 1.4.0
>>> (blob ba4644f) scrollbar for lower pane, i.e. for commitdiff and files
>>> (Comments) views extends past the bottom of the gitk window. Therefore
>>> I cannnot see lower part of commit diff if it is larger than
>>> window height.
>>
>> Yes, and the search field at the bottom is invisible too. Removing
>> line 431:
>>
>> .ctop conf -width $geometry(width) -height $geometry(height)
>>
>> seems to fix it and the window still gets the right size.
>>
>
> No, it does not. It gets the default geometry, not the one it had last time.
Now I see. It is the case when I used gitk from a computer with a desktop
with larger screen height, then on computer with screen height smaller than
gitk height was I had mentioned problem.
Workaround for now is to delete old geometry info from ~/.gitk file
(or just delete whole file).
I don't know Tcl/Tk to make proper fix, i.e. check if restored size is not
larger than available screen size, and use min(saved size, screen size).
Another improvement would be to save the fact that gitk window is maximized
as a symbol, e.g. as equivalent of
set geometry(height) screen(height)
in ~/.gitk
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
From: Timo Hirvonen @ 2006-06-22 7:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: iler.ml, git
In-Reply-To: <7vwtb9veqv.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Yakov Lerner <iler.ml@gmail.com> writes:
>
> > Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
> > command line to all and every %c compiled. In fact the macro
> > is used by only one .c file, and unused by all other .c files.
> > Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of
> > exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
>
> Thanks.
>
> By the way, I really started hating that we have $(GIT_VERSION)
> in $(TRACK_CFLAGS). Since the version string is tied to the
> HEAD commit object name, having it in $(TRACK_CFLAGS) means that
> every time I switch branches, make a new commit on top of the
> current branch, or checkout-compile-and-then-make-local-change
> sequence would force pretty much everything to be rebuilt.
I think this already makes sure git is compiled if version changes:
# These can record GIT_VERSION
git$X git.spec \
$(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \
: GIT-VERSION-FILE
$ git grep GIT_VERSION *.sh *.perl
git-send-email.perl: my $gitversion = '@@GIT_VERSION@@';
git-send-email.perl: if ($gitversion =~ m/..GIT_VERSION../) {
Only git-send-email and git needs to depend on GIT_VERSION.
> For that matter, I do not think tracking prefix_SQ makes much
> sense since what matters are bindir, gitexecdir and template_dir
> which are already covered, and prefix is merely a convenience to
> set these three (four, counting GIT_PYTHON_DIR; we probably
> should add it to TRACK_CFLAGS).
Yes, only ALL_CFLAGS, bindir, gitexecdir, template_dir and
GIT_PYTHON_DIR should be in TRACK_CFLAGS.
--
http://onion.dynserv.net/~timo/
^ permalink raw reply
* Re: [PATCH] [RFC] Introduce Git.pm
From: Jakub Narebski @ 2006-06-22 8:07 UTC (permalink / raw)
To: git
In-Reply-To: <20060622003546.17760.23089.stgit@machine.or.cz>
Petr Baudis wrote:
> Most desirable now is proper error reporting, generic_in() for feeding
> input to Git commands and the repository() constructor doing some poking
> with git-rev-parse to get the git directory and subdirectory prefix.
> Those three are basically the prerequisities for converting git-mv.
I think that repository() constructor (to be converted in the 'new'
constructor I guess) should take 'binbin => "/usr/bin"' argument
optionally, to find where git binary is. 'libexecdir' can be also
supported, or one can get it from 'git --exec-path' and save.
> Currently Git.pm just wraps up exec()s of Git commands, but even that
> is not trivial to get right and various Git perl scripts do it in
> various inconsistent ways.
It would be nice to have also wrapers to reading files from git
repository, ate least some generic read_file/readdir.
For example it might be faster to list branches and/or tags by directly
reading $GIT_DIR/refs directory than using 'git branch' or 'git tag -l'.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ 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