* Re: [PATCH] handle https:// protocol in git-clone
From: Junio C Hamano @ 2006-08-07 18:35 UTC (permalink / raw)
To: Michael Krelin; +Cc: git
In-Reply-To: <20060807151021.GF21051@argo.zzZZzz.net>
Michael Krelin <hacker@klever.net> writes:
> ---
> git-clone.sh | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Thanks. git-fetch and git-ls-remote already do so and it was a
stupid omission not to do this in git-clone.
^ permalink raw reply
* Re: Problem with clone hanging
From: Sergey Vlasov @ 2006-08-07 18:32 UTC (permalink / raw)
To: Bryan O'Sullivan; +Cc: Erik Mouw, git
In-Reply-To: <1154975000.26375.86.camel@sardonyx>
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
On Mon, Aug 07, 2006 at 11:23:20AM -0700, Bryan O'Sullivan wrote:
> On Mon, 2006-08-07 at 21:52 +0400, Sergey Vlasov wrote:
>
> > In the meantime, you can try to specify a local clone of the mainline
> > Linux repository with the --reference=... option to git-clone.
>
> Thanks. I don't know if what I'm cloning is actually a kernel tree,
> unfortunately.
At least git ls-remote git://www.mellanox.co.il/~git/infiniband
suggests this. Of course, it might contains some completely unrelated
branches (with git this is possible), but at least you won't need to
download the whole kernel history since 2.6.12-rc2.
[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply
* Re: Multiple pulls from the same branch in .git/remotes/origin
From: Junio C Hamano @ 2006-08-07 18:28 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
In-Reply-To: <20060807125116.GA28658@mellanox.co.il>
"Michael S. Tsirkin" <mst@mellanox.co.il> writes:
> I get remote linus_master properly fetched into local origin.
> Two questions:
> 1. Isn't is possible to pull from the same remote branch into multiple local
> branches?
Currently, no. The underlying git-fetch-pack makes sure you do
not give the same branches twice on the command line. I think
what the code actually tries to do is to make sure each of the
given refspecs is not ambiguous and matches something, but while
doing so it marks the remote ref that matched ineligible to
match again, which ends up showing the error message you saw.
It might not be too difficult to change it though. This part of
the code is relatively old and I do not remember the details
offhand, other than I remember that the first time I saw it I
had the same confused "Huh? we do not let a ref fetched twice?"
reaction ;-).
^ permalink raw reply
* Re: Problem with clone hanging
From: Bryan O'Sullivan @ 2006-08-07 18:23 UTC (permalink / raw)
To: Sergey Vlasov; +Cc: Erik Mouw, git
In-Reply-To: <20060807215201.b54da1ce.vsu@altlinux.ru>
On Mon, 2006-08-07 at 21:52 +0400, Sergey Vlasov wrote:
> In the meantime, you can try to specify a local clone of the mainline
> Linux repository with the --reference=... option to git-clone.
Thanks. I don't know if what I'm cloning is actually a kernel tree,
unfortunately.
<b
^ permalink raw reply
* Re: Problem with clone hanging
From: Sergey Vlasov @ 2006-08-07 17:52 UTC (permalink / raw)
To: Bryan O'Sullivan; +Cc: Erik Mouw, git
In-Reply-To: <1154971295.26375.48.camel@sardonyx>
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
On Mon, 07 Aug 2006 10:21:35 -0700 Bryan O'Sullivan wrote:
> On Mon, 2006-08-07 at 19:12 +0200, Erik Mouw wrote:
>
> > Looks like the same problem that kernel.org used to have. The other
> > side probably runs git-1.4.0, they should upgrade to 1.4.1.
>
> OK, thanks for the helpful response.
>
> > In the mean
> > time, you could clone using http and later on switch to git transport.
>
> It seems like Mellanox doesn't publish that repository over HTTP, so I'm
> stuck. Tziporet, can you upgrade your git installation, please?
In the meantime, you can try to specify a local clone of the mainline
Linux repository with the --reference=... option to git-clone. Then
the server will need to send only objects which do not exist in the
mainline tree, and should be able to prepare the pack faster.
[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply
* Re: Problem with clone hanging
From: Bryan O'Sullivan @ 2006-08-07 17:21 UTC (permalink / raw)
To: Erik Mouw; +Cc: git, Tziporet Koren
In-Reply-To: <20060807171240.GA19907@harddisk-recovery.com>
On Mon, 2006-08-07 at 19:12 +0200, Erik Mouw wrote:
> Looks like the same problem that kernel.org used to have. The other
> side probably runs git-1.4.0, they should upgrade to 1.4.1.
OK, thanks for the helpful response.
> In the mean
> time, you could clone using http and later on switch to git transport.
It seems like Mellanox doesn't publish that repository over HTTP, so I'm
stuck. Tziporet, can you upgrade your git installation, please?
<b
^ permalink raw reply
* Re: Problem with clone hanging
From: Erik Mouw @ 2006-08-07 17:12 UTC (permalink / raw)
To: Bryan O'Sullivan; +Cc: git, Tziporet Koren
In-Reply-To: <1154968942.26375.23.camel@sardonyx>
On Mon, Aug 07, 2006 at 09:42:22AM -0700, Bryan O'Sullivan wrote:
> I am trying to clone a repository as follows:
>
> git clone git://www.mellanox.co.il/~git/infiniband
>
> This makes a tiny bit of progress, and then hangs, without ever printing
> any output.
>
> Upon doing an strace to figure out what might be going on, I see this:
>
> <...much activity...>
> 28261 write(3, "0032want 8ba130df4b67fa40878ccf80d54615132d24bc68\n", 50) = 50
> 28261 write(3, "0032want 7df8ea909888d4856d3aff1c41192739d715a393\n", 50) = 50
> 28261 write(3, "0000", 4) = 4
> 28261 write(3, "0009done\n", 9) = 9
> 28261 read(3, "0008", 4) = 4
> 28261 read(3, "NAK\n", 4) = 4
> 28261 gettimeofday({1154968213, 166810}, NULL) = 0
> 28261 open("/home/bos/git/ofed_1_1/.git/objects/pack/tmp-ZbzARk", O_RDWR|O_CREAT
> |O_EXCL, 0600) = 4
> 28261 gettimeofday({1154968213, 167511}, NULL) = 0
> 28261 read(3, ...
> <...HANG>
>
> >From which I conclude that the server is telling the client to go away,
> which the client is for some reason ignoring.
>
> Not being a habitual git user, I don't know where to go from here. I'm
> using the latest git, cloned and built as of today. Help!
Looks like the same problem that kernel.org used to have. The other
side probably runs git-1.4.0, they should upgrade to 1.4.1. In the mean
time, you could clone using http and later on switch to git transport.
Erik
--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
^ permalink raw reply
* Re: [PATCH] git-status: colorize status output
From: Sam Ravnborg @ 2006-08-07 17:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Matthias Lederhofer, git, Jeff King
In-Reply-To: <7v64h7e7dm.fsf@assigned-by-dhcp.cox.net>
>
> Not that I can think of, but do people really run "git status"?
Always (almost) before I run 'git fetch'.
I do it to check that I have not made any local modifications that I
need to get rid of before fetching and that I do not have stale files
around.
One example is my copy of Linus' kernel tree. I use it now and then for
small experiments (can I reporoduce this bug etc) and when fetching I
want it to be gone.
Sam
^ permalink raw reply
* Problem with clone hanging
From: Bryan O'Sullivan @ 2006-08-07 16:42 UTC (permalink / raw)
To: git; +Cc: Tziporet Koren
I am trying to clone a repository as follows:
git clone git://www.mellanox.co.il/~git/infiniband
This makes a tiny bit of progress, and then hangs, without ever printing
any output.
Upon doing an strace to figure out what might be going on, I see this:
<...much activity...>
28261 write(3, "0032want 8ba130df4b67fa40878ccf80d54615132d24bc68\n", 50) = 50
28261 write(3, "0032want 7df8ea909888d4856d3aff1c41192739d715a393\n", 50) = 50
28261 write(3, "0000", 4) = 4
28261 write(3, "0009done\n", 9) = 9
28261 read(3, "0008", 4) = 4
28261 read(3, "NAK\n", 4) = 4
28261 gettimeofday({1154968213, 166810}, NULL) = 0
28261 open("/home/bos/git/ofed_1_1/.git/objects/pack/tmp-ZbzARk", O_RDWR|O_CREAT
|O_EXCL, 0600) = 4
28261 gettimeofday({1154968213, 167511}, NULL) = 0
28261 read(3, ...
<...HANG>
>From which I conclude that the server is telling the client to go away,
which the client is for some reason ignoring.
Not being a habitual git user, I don't know where to go from here. I'm
using the latest git, cloned and built as of today. Help!
<b
^ permalink raw reply
* [PATCH] handle https:// protocol in git-clone
From: Michael Krelin @ 2006-08-07 15:10 UTC (permalink / raw)
To: git
---
git-clone.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index acc7a51..7060bda 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -298,7 +298,7 @@ yes,yes)
fi
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
;;
- http://*)
+ https://*|http://*)
if test -z "@@NO_CURL@@"
then
clone_dumb_http "$repo" "$D"
--
1.4.1.1
Love,
H
^ permalink raw reply related
* Re: fast-import and unique objects.
From: Jakub Narebski @ 2006-08-07 14:48 UTC (permalink / raw)
To: git
In-Reply-To: <9e4733910608070737k52aaea7clf871d716d16547c2@mail.gmail.com>
Jon Smirl wrote:
> How about sending out a stream of add/change/delete operations
> interspersed with commits? That would let fast-import track the tree
> and only generate tree nodes when they change.
The problem with CVS, which cvsps (CVS PatchSet) tries to address is that
changes are to a file, and reconstructing which changes go together to make
_one_ commit...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: fast-import and unique objects.
From: Jon Smirl @ 2006-08-07 14:37 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060807050422.GD20514@spearce.org>
On 8/7/06, Shawn Pearce <spearce@spearce.org> wrote:
> > I'm staring at the cvs2svn code now trying to figure out how to modify
> > it without rewriting everything. I may just leave it all alone and
> > build a table with cvs_file:rev to sha-1 mappings. It would be much
> > more efficient to carry sha-1 throughout the stages but that may
> > require significant rework.
>
> Does it matter? How long does the cvs2svn processing take,
> excluding the GIT blob processing that's now known to take 2 hours?
> What's your target for an acceptable conversion time on the system
> you are working on?
As is, it takes the code about a week to import MozCVS into
Subversion. But I've already addressed the core of why that was taking
so long. The original code forks off a copy of cvs for each revision
to exact the text. Doing that 1M times takes about two days. The
version with fast-import takes two hours.
At the end of the process cvs2svn forks off svn 250K times to import
the change sets. That takes about four days to finish. Doing a
fast-import backend should fix that.
> Any thoughts yet on how you might want to feed trees and commits
> to a fast pack writer? I was thinking about doing a stream into
> fast-import such as:
The data I have generates an output that indicates add/change/delete
for each file name. Add/change should have an associated sha-1 for the
new revision. cvs/svn have no concept of trees.
How about sending out a stream of add/change/delete operations
interspersed with commits? That would let fast-import track the tree
and only generate tree nodes when they change.
The protocol may need some thought. I need to be able to handle
branches and labels too.
> <4 byte length of commit><commit><treeent>*<null>
>
> where <commit> is the raw commit minus the first "tree nnn\n" line, and
> <treeent> is:
>
> <type><sp><sha1><sp><path><null>
>
> where <type> is one of 'B' (normal blob), 'L' (symlink), 'X'
> (executable blob), <sha1> is the 40 byte hex, <path> is the file from
> the root of the repository ("src/module/foo.c"), and <sp> and <null>
> are the obvious values. You would feed all tree entries and the pack
> writer would split the stream up into the individual tree objects.
>
> fast-import would generate the tree(s) delta'ing them against the
> prior tree of the same path, prefix "tree nnn\n" to the commit
> blob you supplied, generate the commit, and print out its ID.
> By working from the first commit up to the most recent each tree
> deltas would be using the older tree as the base which may not be
> ideal if a large number of items get added to a tree but should be
> effective enough to generate a reasonably sized initial pack.
>
> It would however mean you need to monitor the output pipe from
> fast-import to get back the commit id so you can use it to prep
> the next commit's parent(s) as you can't produce that in Python.
>
> --
> Shawn.
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Enjoy This is what you always needed to lead a happier, more fulfilling life.
From: Jeanie @ 2006-08-07 14:33 UTC (permalink / raw)
To: git
Fresh stuff
Introducing a great product which will make you a better, more confident man! You are about to gain inches in months or even less - get ready to have more fun!
Whether you are below or above average size, you will do much better with a few extra inches. Expect an explosion in your intimate life very soon - guaranteed! See it here: http://www.dublidom.com/gal/ms/
You don't need to spend huge money on luxury items - it all will be worthless without decent physical equipment.
Too much sit down ah bruck trousers. The best things come in small packages The Best Wine Comes Out of an Old Vessel Fools rush in where angels fear to tread.
^ permalink raw reply
* [PATCH/RFC] gitweb: Great subroutines renaming
From: Jakub Narebski @ 2006-08-07 14:26 UTC (permalink / raw)
To: git
This RFC is about better naming of subroutines in gitweb. The patch was
generated on top of 'next' (7c7e45d0cc0f482aeb19ecb0b56e9e7b65472c56)
using embedded gitweb-rename.sh script.
If one would want to apply patch which was generated without
"subroutine renaming" on top of branch which includes it, simply
run gitweb-unrename.sh, apply patch, run gitweb-rename.sh, commit.
If one would want to apply patch which was created with new subroutine
names on top of branch which doesn not include "subroutine renaming"
commit, simply run gitweb-rename.sh, apply patch, run gitweb-unrename.sh,
then commit.
And in such a case patch calculus, with non-patch operators like those
scripts, is useful.
How should subroutines be named? Do you agree with proposal, or not?
Is such renaming usefull?
Comments? Thought?
-- >8 -- gitweb-rename.sh --
#/bin/sh
rm -f gitweb.perl.re~
echo "Great subroutine renaming"
perl -s -p -i.re~ \
-e 's/\bgit_get_referencing\b/format_mark_referencing/;' \
-e 's/\bgit_read_head\b/git_get_head/;' \
-e 's/\bread_info_ref\b/git_read_info_refs/;' \
-e 's/\bdate_str\b/parse_date/;' \
-e 's/\bgit_read_tag\b/parse_tag/;' \
-e 's/\bgit_read_commit\b/parse_commit/;' \
-e 's/\bgit_blob_plain_mimetype\b/blob_plain_mimetype/;' \
-e 's/\bgit_page_nav\b/git_print_page_nav/;' \
-e 's/\bgit_header_div\b/git_print_header_div/;' \
gitweb.perl
# end of gitweb-rename.sh
-- >8 -- gitweb-unrename.sh --
#/bin/sh
rm -f gitweb.perl.un~
echo "Reverting Great subroutine renaming"
perl -s -p -i.un~ \
-e 's/\bformat_mark_referencing\b/git_get_referencing/;' \
-e 's/\bgit_get_head\b/git_read_head/;' \
-e 's/\bgit_read_info_refs\b/read_info_ref/;' \
-e 's/\bparse_date\b/date_str/;' \
-e 's/\bparse_tag\b/git_read_tag/;' \
-e 's/\bparse_commit\b/git_read_commit/;' \
-e 's/\bblob_plain_mimetype\b/git_blob_plain_mimetype/;' \
-e 's/\bgit_print_page_nav\b/git_page_nav/;' \
-e 's/\bgit_print_header_div\b/git_header_div/;' \
gitweb.perl
# end of gitweb-unrename.sh
+++
From 73aac631709c11d01ac36a1f3f8c8ea3d1591b4d Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Mon, 7 Aug 2006 15:32:07 +0200
Subject: [PATCH] gitweb: Great subroutines renaming
Rename some of subroutines to better reflect what they do.
Some renames were not performed because subroutine name
reflects hash key.
Subroutines name guideline:
* git_ prefix for subroutines related to git commands,
or to gitweb actions
* git_get_ prefix for subroutines calling git command
and returning some output
* git_read_ prefix for subroutines directly accessing git
repository files
* parse_ prefix for subroutines parsing some text, or reading and
parsing some text into hash or list
* format_ prefix for subroutines formatting/post-processing some
HTML/text fragment
* _get_ infix for subroutines which return result
* _print_ infix for subroutines which print fragment of output
* _body suffix for subroutines which outputs main part (body)
of related action
* _nav suffix for subroutines related to navigation bars
* _div suffix for subroutines returning or ptinting div element
Renames:
- git_get_referencing => format_mark_referencing
- git_read_head => git_get_head
- read_info_ref => git_read_info_refs
- date_str => parse_date
- git_read_tag => parse_tag
- git_read_commit => parse_commit
- git_blob_plain_mimetype => blob_plain_mimetype
- git_page_nav => git_print_page_nav
- git_header_div => git_print_header_div
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.perl | 218 ++++++++++++++++++++++++++--------------------------
1 files changed, 109 insertions(+), 109 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b3bfc6b..d8dbd3d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -362,7 +362,7 @@ sub format_log_line_html {
}
# format marker of refs pointing to given object
-sub git_get_referencing {
+sub format_mark_referencing {
my ($refs, $id) = @_;
if (defined $refs->{$id}) {
@@ -376,7 +376,7 @@ ## -------------------------------------
## git utility subroutines, invoking git commands
# get HEAD ref of given project as hash
-sub git_read_head {
+sub git_get_head {
my $project = shift;
my $oENV = $ENV{'GIT_DIR'};
my $retval = undef;
@@ -511,7 +511,7 @@ sub git_read_projects {
return @list;
}
-sub read_info_ref {
+sub git_read_info_refs {
my $type = shift || "";
my %refs;
# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11
@@ -536,7 +536,7 @@ sub read_info_ref {
## ----------------------------------------------------------------------
## parse to hash functions
-sub date_str {
+sub parse_date {
my $epoch = shift;
my $tz = shift || "-0000";
@@ -561,7 +561,7 @@ sub date_str {
return %date;
}
-sub git_read_tag {
+sub parse_tag {
my $tag_id = shift;
my %tag;
my @comment;
@@ -596,7 +596,7 @@ sub git_read_tag {
return %tag
}
-sub git_read_commit {
+sub parse_commit {
my $commit_id = shift;
my $commit_text = shift;
@@ -716,10 +716,10 @@ sub git_read_refs {
$ref_item{'epoch'} = 0;
$ref_item{'age'} = "unknown";
if ($type eq "tag") {
- my %tag = git_read_tag($ref_id);
+ my %tag = parse_tag($ref_id);
$ref_item{'comment'} = $tag{'comment'};
if ($tag{'type'} eq "commit") {
- %co = git_read_commit($tag{'object'});
+ %co = parse_commit($tag{'object'});
$ref_item{'epoch'} = $co{'committer_epoch'};
$ref_item{'age'} = $co{'age_string'};
} elsif (defined($tag{'epoch'})) {
@@ -731,7 +731,7 @@ sub git_read_refs {
$ref_item{'name'} = $tag{'name'};
$ref_item{'refid'} = $tag{'object'};
} elsif ($type eq "commit"){
- %co = git_read_commit($ref_id);
+ %co = parse_commit($ref_id);
$ref_item{'reftype'} = "commit";
$ref_item{'name'} = $ref_file;
$ref_item{'title'} = $co{'title'};
@@ -806,7 +806,7 @@ sub mimetype_guess {
return $mime;
}
-sub git_blob_plain_mimetype {
+sub blob_plain_mimetype {
my $fd = shift;
my $filename = shift;
@@ -955,7 +955,7 @@ sub die_error {
## ----------------------------------------------------------------------
## functions printing or outputting HTML: navigation
-sub git_page_nav {
+sub git_print_page_nav {
my ($current, $suppress, $head, $treehead, $treebase, $extra) = @_;
$extra = '' if !defined $extra; # pager or formats
@@ -1022,7 +1022,7 @@ sub git_get_paging_nav {
## ......................................................................
## functions printing or outputting HTML: div
-sub git_header_div {
+sub git_print_header_div {
my ($action, $title, $hash, $hash_base) = @_;
my $rest = '';
@@ -1062,10 +1062,10 @@ sub git_shortlog_body {
my $alternate = 0;
for (my $i = $from; $i <= $to; $i++) {
my $commit = $revlist->[$i];
- #my $ref = defined $refs ? git_get_referencing($refs, $commit) : '';
- my $ref = git_get_referencing($refs, $commit);
- my %co = git_read_commit($commit);
- my %ad = date_str($co{'author_epoch'});
+ #my $ref = defined $refs ? format_mark_referencing($refs, $commit) : '';
+ my $ref = format_mark_referencing($refs, $commit);
+ my %co = parse_commit($commit);
+ my %ad = parse_date($co{'author_epoch'});
if ($alternate) {
print "<tr class=\"dark\">\n";
} else {
@@ -1289,12 +1289,12 @@ sub git_project_list {
die_error(undef, "No projects found");
}
foreach my $pr (@list) {
- my $head = git_read_head($pr->{'path'});
+ my $head = git_get_head($pr->{'path'});
if (!defined $head) {
next;
}
$ENV{'GIT_DIR'} = "$projectroot/$pr->{'path'}";
- my %co = git_read_commit($head);
+ my %co = parse_commit($head);
if (!%co) {
next;
}
@@ -1385,9 +1385,9 @@ sub git_project_list {
sub git_summary {
my $descr = git_read_description($project) || "none";
- my $head = git_read_head($project);
- my %co = git_read_commit($head);
- my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
+ my $head = git_get_head($project);
+ my %co = parse_commit($head);
+ my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
my $owner;
if (-f $projects_list) {
@@ -1408,9 +1408,9 @@ sub git_summary {
$owner = get_file_owner("$projectroot/$project");
}
- my $refs = read_info_ref();
+ my $refs = git_read_info_refs();
git_header_html();
- git_page_nav('summary','', $head);
+ git_print_page_nav('summary','', $head);
print "<div class=\"title\"> </div>\n";
print "<table cellspacing=\"0\">\n" .
@@ -1419,24 +1419,24 @@ sub git_summary {
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
"</table>\n";
- open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_read_head($project)
+ open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_get_head($project)
or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
- git_header_div('shortlog');
+ git_print_header_div('shortlog');
git_shortlog_body(\@revlist, 0, 15, $refs,
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "..."));
my $taglist = git_read_refs("refs/tags");
if (defined @$taglist) {
- git_header_div('tags');
+ git_print_header_div('tags');
git_tags_body($taglist, 0, 15,
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tags")}, "..."));
}
my $headlist = git_read_refs("refs/heads");
if (defined @$headlist) {
- git_header_div('heads');
+ git_print_header_div('heads');
git_heads_body($headlist, $head, 0, 15,
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "..."));
}
@@ -1445,11 +1445,11 @@ sub git_summary {
}
sub git_tag {
- my $head = git_read_head($project);
+ my $head = git_get_head($project);
git_header_html();
- git_page_nav('','', $head,undef,$head);
- my %tag = git_read_tag($hash);
- git_header_div('commit', esc_html($tag{'name'}), $hash);
+ git_print_page_nav('','', $head,undef,$head);
+ my %tag = parse_tag($hash);
+ git_print_header_div('commit', esc_html($tag{'name'}), $hash);
print "<div class=\"title_text\">\n" .
"<table cellspacing=\"0\">\n" .
"<tr>\n" .
@@ -1458,7 +1458,7 @@ sub git_tag {
"<td class=\"link\">" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'type'}) . "</td>\n" .
"</tr>\n";
if (defined($tag{'author'})) {
- my %ad = date_str($tag{'epoch'}, $tag{'tz'});
+ my %ad = parse_date($tag{'epoch'}, $tag{'tz'});
print "<tr><td>author</td><td>" . esc_html($tag{'author'}) . "</td></tr>\n";
print "<tr><td></td><td>" . $ad{'rfc2822'} . sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) . "</td></tr>\n";
}
@@ -1478,9 +1478,9 @@ sub git_blame2 {
my $ftype;
die_error(undef, "Permission denied") if (!git_get_project_config_bool ('blame'));
die_error('404 Not Found', "File name not defined") if (!$file_name);
- $hash_base ||= git_read_head($project);
+ $hash_base ||= git_get_head($project);
die_error(undef, "Couldn't find base commit") unless ($hash_base);
- my %co = git_read_commit($hash_base)
+ my %co = parse_commit($hash_base)
or die_error(undef, "Reading commit failed");
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
@@ -1496,8 +1496,8 @@ sub git_blame2 {
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head");
- git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
- git_header_div('commit', esc_html($co{'title'}), $hash_base);
+ git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
git_print_page_path($file_name, $ftype);
my @rev_color = (qw(light dark));
my $num_colors = scalar(@rev_color);
@@ -1536,9 +1536,9 @@ sub git_blame {
my $fd;
die_error('403 Permission denied', "Permission denied") if (!git_get_project_config_bool ('blame'));
die_error('404 Not Found', "File name not defined") if (!$file_name);
- $hash_base ||= git_read_head($project);
+ $hash_base ||= git_get_head($project);
die_error(undef, "Couldn't find base commit") unless ($hash_base);
- my %co = git_read_commit($hash_base)
+ my %co = parse_commit($hash_base)
or die_error(undef, "Reading commit failed");
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
@@ -1550,8 +1550,8 @@ sub git_blame {
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head");
- git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
- git_header_div('commit', esc_html($co{'title'}), $hash_base);
+ git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
git_print_page_path($file_name, 'blob');
print "<div class=\"page_body\">\n";
print <<HTML;
@@ -1619,10 +1619,10 @@ HTML
}
sub git_tags {
- my $head = git_read_head($project);
+ my $head = git_get_head($project);
git_header_html();
- git_page_nav('','', $head,undef,$head);
- git_header_div('summary', $project);
+ git_print_page_nav('','', $head,undef,$head);
+ git_print_header_div('summary', $project);
my $taglist = git_read_refs("refs/tags");
if (defined @$taglist) {
@@ -1632,10 +1632,10 @@ sub git_tags {
}
sub git_heads {
- my $head = git_read_head($project);
+ my $head = git_get_head($project);
git_header_html();
- git_page_nav('','', $head,undef,$head);
- git_header_div('summary', $project);
+ git_print_page_nav('','', $head,undef,$head);
+ git_print_header_div('summary', $project);
my $taglist = git_read_refs("refs/heads");
my $alternate = 0;
@@ -1648,7 +1648,7 @@ sub git_heads {
sub git_blob_plain {
if (!defined $hash) {
if (defined $file_name) {
- my $base = $hash_base || git_read_head($project);
+ my $base = $hash_base || git_get_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
or die_error(undef, "Error lookup file");
} else {
@@ -1659,7 +1659,7 @@ sub git_blob_plain {
open my $fd, "-|", $GIT, "cat-file", "blob", $hash
or die_error(undef, "Couldn't cat $file_name, $hash");
- $type ||= git_blob_plain_mimetype($fd, $file_name);
+ $type ||= blob_plain_mimetype($fd, $file_name);
# save as filename, even when no $file_name is given
my $save_as = "$hash";
@@ -1681,7 +1681,7 @@ sub git_blob_plain {
sub git_blob {
if (!defined $hash) {
if (defined $file_name) {
- my $base = $hash_base || git_read_head($project);
+ my $base = $hash_base || git_get_head($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
or die_error(undef, "Error lookup file");
} else {
@@ -1691,14 +1691,14 @@ sub git_blob {
my $have_blame = git_get_project_config_bool ('blame');
open my $fd, "-|", $GIT, "cat-file", "blob", $hash
or die_error(undef, "Couldn't cat $file_name, $hash");
- my $mimetype = git_blob_plain_mimetype($fd, $file_name);
+ my $mimetype = blob_plain_mimetype($fd, $file_name);
if ($mimetype !~ m/^text\//) {
close $fd;
return git_blob_plain($mimetype);
}
git_header_html();
my $formats_nav = '';
- if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
+ if (defined $hash_base && (my %co = parse_commit($hash_base))) {
if (defined $file_name) {
if ($have_blame) {
$formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
@@ -1709,8 +1709,8 @@ sub git_blob {
} else {
$formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash")}, "plain");
}
- git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
- git_header_div('commit', esc_html($co{'title'}), $hash_base);
+ git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
} else {
print "<div class=\"page_nav\">\n" .
"<br/><br/></div>\n" .
@@ -1732,7 +1732,7 @@ sub git_blob {
sub git_tree {
if (!defined $hash) {
- $hash = git_read_head($project);
+ $hash = git_get_head($project);
if (defined $file_name) {
my $base = $hash_base || $hash;
$hash = git_get_hash_by_path($base, $file_name, "tree");
@@ -1748,16 +1748,16 @@ sub git_tree {
close $fd or die_error(undef, "Reading tree failed");
$/ = "\n";
- my $refs = read_info_ref();
- my $ref = git_get_referencing($refs, $hash_base);
+ my $refs = git_read_info_refs();
+ my $ref = format_mark_referencing($refs, $hash_base);
git_header_html();
my $base_key = "";
my $base = "";
my $have_blame = git_get_project_config_bool ('blame');
- if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
+ if (defined $hash_base && (my %co = parse_commit($hash_base))) {
$base_key = ";hb=$hash_base";
- git_page_nav('tree','', $hash_base);
- git_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
+ git_print_page_nav('tree','', $hash_base);
+ git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
} else {
print "<div class=\"page_nav\">\n";
print "<br/><br/></div>\n";
@@ -1813,14 +1813,14 @@ sub git_tree {
}
sub git_log {
- my $head = git_read_head($project);
+ my $head = git_get_head($project);
if (!defined $hash) {
$hash = $head;
}
if (!defined $page) {
$page = 0;
}
- my $refs = read_info_ref();
+ my $refs = git_read_info_refs();
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -1831,21 +1831,21 @@ sub git_log {
my $paging_nav = git_get_paging_nav('log', $hash, $head, $page, $#revlist);
git_header_html();
- git_page_nav('log','', $hash,undef,undef, $paging_nav);
+ git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
if (!@revlist) {
- my %co = git_read_commit($hash);
+ my %co = parse_commit($hash);
- git_header_div('summary', $project);
+ git_print_header_div('summary', $project);
print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n";
}
for (my $i = ($page * 100); $i <= $#revlist; $i++) {
my $commit = $revlist[$i];
- my $ref = git_get_referencing($refs, $commit);
- my %co = git_read_commit($commit);
+ my $ref = format_mark_referencing($refs, $commit);
+ my %co = parse_commit($commit);
next if !%co;
- my %ad = date_str($co{'author_epoch'});
- git_header_div('commit',
+ my %ad = parse_date($co{'author_epoch'});
+ git_print_header_div('commit',
"<span class=\"age\">$co{'age_string'}</span>" .
esc_html($co{'title'}) . $ref,
$commit);
@@ -1883,12 +1883,12 @@ sub git_log {
}
sub git_commit {
- my %co = git_read_commit($hash);
+ my %co = parse_commit($hash);
if (!%co) {
die_error(undef, "Unknown commit object");
}
- my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
- my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
+ my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
+ my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
my $parent = $co{'parent'};
if (!defined $parent) {
@@ -1904,22 +1904,22 @@ sub git_commit {
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}
- my $refs = read_info_ref();
- my $ref = git_get_referencing($refs, $co{'id'});
+ my $refs = git_read_info_refs();
+ my $ref = format_mark_referencing($refs, $co{'id'});
my $formats_nav = '';
if (defined $file_name && defined $co{'parent'}) {
my $parent = $co{'parent'};
$formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;hb=$parent;f=$file_name")}, "blame");
}
git_header_html(undef, $expires);
- git_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
+ git_print_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
$hash, $co{'tree'}, $hash,
$formats_nav);
if (defined $co{'parent'}) {
- git_header_div('commitdiff', esc_html($co{'title'}) . $ref, $hash);
+ git_print_header_div('commitdiff', esc_html($co{'title'}) . $ref, $hash);
} else {
- git_header_div('tree', esc_html($co{'title'}) . $ref, $co{'tree'}, $hash);
+ git_print_header_div('tree', esc_html($co{'title'}) . $ref, $co{'tree'}, $hash);
}
print "<div class=\"title_text\">\n" .
"<table cellspacing=\"0\">\n";
@@ -2081,11 +2081,11 @@ sub git_commit {
sub git_blobdiff {
mkdir($git_temp, 0700);
git_header_html();
- if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
+ if (defined $hash_base && (my %co = parse_commit($hash_base))) {
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
- git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
- git_header_div('commit', esc_html($co{'title'}), $hash_base);
+ git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
} else {
print "<div class=\"page_nav\">\n" .
"<br/><br/></div>\n" .
@@ -2111,7 +2111,7 @@ sub git_blobdiff_plain {
sub git_commitdiff {
mkdir($git_temp, 0700);
- my %co = git_read_commit($hash);
+ my %co = parse_commit($hash);
if (!%co) {
die_error(undef, "Unknown commit object");
}
@@ -2128,13 +2128,13 @@ sub git_commitdiff {
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}
- my $refs = read_info_ref();
- my $ref = git_get_referencing($refs, $co{'id'});
+ my $refs = git_read_info_refs();
+ my $ref = format_mark_referencing($refs, $co{'id'});
my $formats_nav =
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
git_header_html(undef, $expires);
- git_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
- git_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
+ git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
+ git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
print "<div class=\"page_body\">\n";
my $comment = $co{'comment'};
my $empty = 0;
@@ -2200,7 +2200,7 @@ sub git_commitdiff {
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
- my %co = git_read_commit($hash);
+ my %co = parse_commit($hash);
if (!%co) {
die_error(undef, "Unknown commit object");
}
@@ -2214,7 +2214,7 @@ sub git_commitdiff_plain {
# try to figure out the next tag after this commit
my $tagname;
- my $refs = read_info_ref("tags");
+ my $refs = git_read_info_refs("tags");
open $fd, "-|", $GIT, "rev-list", "HEAD";
my @commits = map { chomp; $_ } <$fd>;
close $fd;
@@ -2228,7 +2228,7 @@ sub git_commitdiff_plain {
}
print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
- my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
+ my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
my $comment = $co{'comment'};
print "From: $co{'author'}\n" .
"Date: $ad{'rfc2822'} ($ad{'tz_local'})\n".
@@ -2264,17 +2264,17 @@ sub git_commitdiff_plain {
sub git_history {
if (!defined $hash_base) {
- $hash_base = git_read_head($project);
+ $hash_base = git_get_head($project);
}
my $ftype;
- my %co = git_read_commit($hash_base);
+ my %co = parse_commit($hash_base);
if (!%co) {
die_error(undef, "Unknown commit object");
}
- my $refs = read_info_ref();
+ my $refs = git_read_info_refs();
git_header_html();
- git_page_nav('','', $hash_base,$co{'tree'},$hash_base);
- git_header_div('commit', esc_html($co{'title'}), $hash_base);
+ git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
if (!defined $hash && defined $file_name) {
$hash = git_get_hash_by_path($hash_base, $file_name);
}
@@ -2290,11 +2290,11 @@ sub git_history {
while (my $line = <$fd>) {
if ($line =~ m/^([0-9a-fA-F]{40})/){
my $commit = $1;
- my %co = git_read_commit($commit);
+ my %co = parse_commit($commit);
if (!%co) {
next;
}
- my $ref = git_get_referencing($refs, $commit);
+ my $ref = format_mark_referencing($refs, $commit);
if ($alternate) {
print "<tr class=\"dark\">\n";
} else {
@@ -2330,9 +2330,9 @@ sub git_search {
die_error(undef, "Text field empty");
}
if (!defined $hash) {
- $hash = git_read_head($project);
+ $hash = git_get_head($project);
}
- my %co = git_read_commit($hash);
+ my %co = parse_commit($hash);
if (!%co) {
die_error(undef, "Unknown commit object");
}
@@ -2351,8 +2351,8 @@ sub git_search {
$pickaxe_search = 1;
}
git_header_html();
- git_page_nav('','', $hash,$co{'tree'},$hash);
- git_header_div('commit', esc_html($co{'title'}), $hash);
+ git_print_page_nav('','', $hash,$co{'tree'},$hash);
+ git_print_header_div('commit', esc_html($co{'title'}), $hash);
print "<table cellspacing=\"0\">\n";
my $alternate = 0;
@@ -2370,7 +2370,7 @@ sub git_search {
next;
}
my @commit_lines = split "\n", $commit_text;
- my %co = git_read_commit(undef, \@commit_lines);
+ my %co = parse_commit(undef, \@commit_lines);
if (!%co) {
next;
}
@@ -2451,7 +2451,7 @@ sub git_search {
print "</td>\n" .
"</tr>\n";
}
- %co = git_read_commit($1);
+ %co = parse_commit($1);
}
}
close $fd;
@@ -2461,14 +2461,14 @@ sub git_search {
}
sub git_shortlog {
- my $head = git_read_head($project);
+ my $head = git_get_head($project);
if (!defined $hash) {
$hash = $head;
}
if (!defined $page) {
$page = 0;
}
- my $refs = read_info_ref();
+ my $refs = git_read_info_refs();
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -2486,8 +2486,8 @@ sub git_shortlog {
git_header_html();
- git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
- git_header_div('summary', $project);
+ git_print_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
+ git_print_header_div('summary', $project);
git_shortlog_body(\@revlist, ($page * 100), $#revlist, $refs, $next_link);
@@ -2499,7 +2499,7 @@ ## feeds (RSS, OPML)
sub git_rss {
# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
- open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_read_head($project)
+ open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_get_head($project)
or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-rev-list failed");
@@ -2514,12 +2514,12 @@ sub git_rss {
for (my $i = 0; $i <= $#revlist; $i++) {
my $commit = $revlist[$i];
- my %co = git_read_commit($commit);
+ my %co = parse_commit($commit);
# we read 150, we always show 30 and the ones more recent than 48 hours
if (($i >= 20) && ((time - $co{'committer_epoch'}) > 48*60*60)) {
last;
}
- my %cd = date_str($co{'committer_epoch'});
+ my %cd = parse_date($co{'committer_epoch'});
open $fd, "-|", $GIT, "diff-tree", '-r', $co{'parent'}, $co{'id'} or next;
my @difftree = map { chomp; $_ } <$fd>;
close $fd or next;
@@ -2569,12 +2569,12 @@ sub git_opml {
foreach my $pr (@list) {
my %proj = %$pr;
- my $head = git_read_head($proj{'path'});
+ my $head = git_get_head($proj{'path'});
if (!defined $head) {
next;
}
$ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
- my %co = git_read_commit($head);
+ my %co = parse_commit($head);
if (!%co) {
next;
}
--
1.4.1.1
^ permalink raw reply related
* Re: git-diff between /dev/null and blob
From: Jakub Narebski @ 2006-08-07 12:52 UTC (permalink / raw)
To: git
In-Reply-To: <7vejvt8s24.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> git diff v0.99:pull.h fetch.h
>
> echo extra >>Makefile && git diff :0:Makefile HEAD^^:Makefile
>
> H=`(cat Makefile; echo extra) | git hash-object -w --stdin`
> echo "100644 $H 2 foobar" | git update-index --add --index-info
> git diff :2:foobar :Makefile
>
>> git-diff doesn't understand :<stage>:<filename> and :<filename> for
>> accessing index version of blob (git-cat-file for example understands
>> it).
>
> You probably got this impression from a botched experiment or
> something, but this statement is wrong as demonstrated above.
Right, sorry.
And you can write ./<filename> to distinguish it from revision name, so
proposed ::<filename> extension is not needed.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Multiple pulls from the same branch in .git/remotes/origin
From: Michael S. Tsirkin @ 2006-08-07 12:51 UTC (permalink / raw)
To: git
In-Reply-To: <20060727140343.GS9411@mellanox.co.il>
Hi, all!
I have
> git --version
git version 1.4.2.rc3.g0d95
and I have put the following in .git/remotes/origin
>cat .git/remotes/origin
URL: ssh://mst@frodo/scm/git/linux-2.6
Pull: refs/heads/linus_master:refs/heads/origin
Pull: refs/heads/linus_master:refs/heads/linus_master_branch
now I get:
>git fetch origin
error: no such remote ref refs/heads/linus_master
Fetch failure: ssh://mst@frodo/scm/git/linux-2.6
However, if I remove the second line, like this:
>cat .git/remotes/origin
URL: ssh://mst@frodo/scm/git/linux-2.6
Pull: refs/heads/linus_master:refs/heads/origin
I get remote linus_master properly fetched into local origin.
Two questions:
1. Isn't is possible to pull from the same remote branch into multiple local
branches?
2. Even if not, isn't the error message above a bit strange?
After all, the remote branch *does* exist.
Thanks,
--
MST
^ permalink raw reply
* [PATCH 2/2] annotate: Fix bug when parsing merges with differing real and logical parents.
From: Ryan Anderson @ 2006-08-07 12:11 UTC (permalink / raw)
To: junkio; +Cc: git, Jeff King, Ryan Anderson
In-Reply-To: <1154952684908-git-send-email-ryan@michonline.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
git-annotate.perl | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 122 insertions(+), 6 deletions(-)
diff --git a/git-annotate.perl b/git-annotate.perl
index 505b5cc..215ed26 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -147,7 +147,7 @@ sub init_claim {
sub handle_rev {
- my $i = 0;
+ my $revseen = 0;
my %seen;
while (my $rev = shift @revqueue) {
next if $seen{$rev}++;
@@ -247,22 +247,129 @@ sub git_find_parent {
return $parent;
}
+sub git_find_all_parents {
+ my ($rev) = @_;
+
+ my $revparent = open_pipe("git-rev-list","--remove-empty", "--parents","--max-count=1","$rev")
+ or die "Failed to open git-rev-list to find a single parent: $!";
+
+ my $parentline = <$revparent>;
+ chomp $parentline;
+ my ($origrev, @parents) = split m/\s+/, $parentline;
+
+ close($revparent);
+
+ return @parents;
+}
+
+sub git_merge_base {
+ my ($rev1, $rev2) = @_;
+
+ my $mb = open_pipe("git-merge-base", $rev1, $rev2)
+ or die "Failed to open git-merge-base: $!";
+
+ my $base = <$mb>;
+ chomp $base;
+
+ close($mb);
+
+ return $base;
+}
+
+# Construct a set of pseudo parents that are in the same order,
+# and the same quantity as the real parents,
+# but whose SHA1s are as similar to the logical parents
+# as possible.
+sub get_pseudo_parents {
+ my ($all, $fake) = @_;
+
+ my @all = @$all;
+ my @fake = @$fake;
+
+ my @pseudo;
+
+ my %fake = map {$_ => 1} @fake;
+ my %seenfake;
+
+ my $fakeidx = 0;
+ foreach my $p (@all) {
+ if (exists $fake{$p}) {
+ if ($fake[$fakeidx] ne $p) {
+ die sprintf("parent mismatch: %s != %s\nall:%s\nfake:%s\n",
+ $fake[$fakeidx], $p,
+ join(", ", @all),
+ join(", ", @fake),
+ );
+ }
+
+ push @pseudo, $p;
+ $fakeidx++;
+ $seenfake{$p}++;
+
+ } else {
+ my $base = git_merge_base($fake[$fakeidx], $p);
+ if ($base ne $fake[$fakeidx]) {
+ die sprintf("Result of merge-base doesn't match fake: %s,%s != %s\n",
+ $fake[$fakeidx], $p, $base);
+ }
+
+ # The details of how we parse the diffs
+ # mean that we cannot have a duplicate
+ # revision in the list, so if we've already
+ # seen the revision we would normally add, just use
+ # the actual revision.
+ if ($seenfake{$base}) {
+ push @pseudo, $p;
+ } else {
+ push @pseudo, $base;
+ $seenfake{$base}++;
+ }
+ }
+ }
+
+ return @pseudo;
+}
+
# Get a diff between the current revision and a parent.
# Record the commit information that results.
sub git_diff_parse {
my ($parents, $rev, %revinfo) = @_;
+ my @pseudo_parents;
+ my @command = ("git-diff-tree");
+ my $revision_spec;
+
+ if (scalar @$parents == 1) {
+
+ $revision_spec = join("..", $parents->[0], $rev);
+ @pseudo_parents = @$parents;
+ } else {
+ my @all_parents = git_find_all_parents($rev);
+
+ if (@all_parents != @$parents) {
+ @pseudo_parents = get_pseudo_parents(\@all_parents, $parents);
+ } else {
+ @pseudo_parents = @$parents;
+ }
+
+ $revision_spec = $rev;
+ push @command, "-c";
+ }
+
my @filenames = ( $revs{$rev}{'filename'} );
+
foreach my $parent (@$parents) {
push @filenames, $revs{$parent}{'filename'};
}
- my $diff = open_pipe("git-diff-tree","-M","-p","-c",$rev,"--",
- @filenames )
+ push @command, "-p", "-M", $revision_spec, "--", @filenames;
+
+
+ my $diff = open_pipe( @command )
or die "Failed to call git-diff for annotation: $!";
- _git_diff_parse($diff, $parents, $rev, %revinfo);
+ _git_diff_parse($diff, \@pseudo_parents, $rev, %revinfo);
close($diff);
}
@@ -283,6 +390,7 @@ sub _git_diff_parse {
$diff_header_regexp .= "@" x @$parents;
$diff_header_regexp .= ' -\d+,\d+' x @$parents;
$diff_header_regexp .= ' \+(\d+),\d+';
+ $diff_header_regexp .= " " . ("@" x @$parents);
my %claim_regexps;
my $allparentplus = '^' . '\\+' x @$parents . '(.*)$';
@@ -311,6 +419,7 @@ sub _git_diff_parse {
DIFF:
while(<$diff>) {
chomp;
+ #printf("%d:%s:\n", $gotheader, $_);
if (m/$diff_header_regexp/) {
$remstart = $1 - 1;
# (0-based arrays)
@@ -391,10 +500,17 @@ sub _git_diff_parse {
printf("parent %s is on line %d\n", $parent, $pi{$parent});
}
+ my @context;
+ for (my $i = -2; $i < 2; $i++) {
+ push @context, get_line($slines, $ri + $i);
+ }
+ my $context = join("\n", @context);
+
+ my $justline = substr($_, scalar @$parents);
die sprintf("Line %d, does not match:\n|%s|\n|%s|\n%s\n",
$ri,
- substr($_,scalar @$parents),
- get_line($slines,$ri), $rev);
+ $justline,
+ $context);
}
foreach my $parent (@$parents) {
$plines{$parent}[$pi{$parent}++] = $slines->[$ri];
--
1.4.2.rc3.g6487-dirty
^ permalink raw reply related
* [PATCH 1/2] log-tree: show_log() should respect the setting of diffopt->line_termination
From: Ryan Anderson @ 2006-08-07 12:11 UTC (permalink / raw)
To: junkio; +Cc: git, Jeff King, Ryan Anderson
In-Reply-To: <20060807115000.GC15477@h4x0r5.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
log-tree.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/log-tree.c b/log-tree.c
index b67b8dd..05ede0c 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -59,7 +59,7 @@ void show_log(struct rev_info *opt, cons
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
if (opt->parents)
show_parents(commit, abbrev_commit);
- putchar('\n');
+ putchar(opt->diffopt.line_termination);
return;
}
--
1.4.2.rc3.g6487-dirty
^ permalink raw reply related
* [PATCH] Fixes git-cherry algorithmic flaws
From: Ilpo Järvinen @ 2006-08-07 10:30 UTC (permalink / raw)
To: git; +Cc: junkio
Old algorithm:
- printed IDs of identical patches with minus (-) sign; they
should not be printed at all
- did not print anything from the changes in the upstream
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
git-cherry.sh | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/git-cherry.sh b/git-cherry.sh
index f0e8831..fdf3de7 100755
--- a/git-cherry.sh
+++ b/git-cherry.sh
@@ -74,7 +74,8 @@ do
then
if test -f "$patch/$2"
then
- sign=-
+ rm -rf "$patch/$2"
+ continue
else
sign=+
fi
@@ -88,6 +89,29 @@ do
esac
fi
done
+
+for c in $inup
+do
+ set x `git-diff-tree -p $c | git-patch-id`
+ if test "$2" != ""
+ then
+ if test -f "$patch/$2"
+ then
+ sign=-
+ else
+ continue
+ fi
+ case "$verbose" in
+ t)
+ c=$(git-rev-list --pretty=oneline --max-count=1 $c)
+ esac
+ case "$O" in
+ '') O="$sign $c" ;;
+ *) O="$sign $c$LF$O" ;;
+ esac
+ fi
+done
+
case "$O" in
'') ;;
*) echo "$O" ;;
--
1.4.1
^ permalink raw reply related
* Re: git-annotate bug report
From: Ryan Anderson @ 2006-08-07 11:50 UTC (permalink / raw)
To: Jeff King; +Cc: ryan, git
In-Reply-To: <20060803203848.GA15121@coredump.intra.peff.net>
On Thu, Aug 03, 2006 at 04:38:48PM -0400, Jeff King wrote:
> git-annotate on the tip of master seems to be broken for some files (but
> not for others):
Well, I think I've found a few bugs here tonight, basically all are
related to handling merges correctly.
First, a trivial one:
git diff-tree -M --name-status -z outputs the sha1 without honoring the
-z. Patch following this email.
Second, one I don't know how to fix, at the moment:
git annotate uses the automatic tree simplification that git rev-list
does. So, when it sees a commit with 1 parent, it assumes that it
really only has one parent. git diff-tree -c doesn't know about this
same tree simplification, and, in the case of a merge commit, will still
output the -c format patch.
That particular case is trivial, simply remove the -c from commits where
I *know* there is only parent, and ask for the exact diff I need, from
the parent to the current rev.
There is, unfortunately, another situation, that of an octopus merge.
In the case of read-tree.c (after the rename is followed), the commit
7bd1527d2d8c80a6e9a0f8583082a5aee5428c68 is problematic. In it we have
a 4-way merge, yet only 3 paths affected read-tree.c. The diff-parsing
in annotate constructs a regular expression to find the diff header and
read out the line number to work on, and also to construct some regular
expressions from which to tell which lines affect which parents.
For example, it looks for a line like:
+ ++Line added in 3 parents
with dynamically generated regular expressions. These, of course, need
to know how many parents there are. The fact that diff-tree uses a
different number of parents makes the parsing fail, and then, the fact
that there isn't a great way to figure out which of the real parents
corresponds to the pseudo parents, makes this whole thing very
messy to fix.
So, the solution I've settled on is to use git merge-base to perform
some analysis and create a pseudo-parent list that is the same size as
the actual parent list, but consisting mostly of the fake parents
git-rev-list gives me.
If anyone else is confused by this email, it's probably because I
stopped and fixed a bug in the middle of writing it.
Patches as followups to this.
--
Ryan Anderson
sometimes Pug Majere
^ permalink raw reply
* Re: [RFC] diff: support custom callbacks for output
From: Junio C Hamano @ 2006-08-07 10:16 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20060807091953.GA31137@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I'm starting by writing run_status in C. Once that is working (which
> should be soon), I believe it should suffice as a vanilla git-status
> (do people actually do things like git-status with flags? It's not
> documented, but it does work).
Well, "git-status" is by definition (see list discussion when it
was made into its current shape) a preview of "git-commit", so
all the options are supported and needs to work with options. I
just noticed that its documentation has not been updated, though.
So I'd suggest, mildly, against naming your "run_status()
equivalent" git-status. And if you follow through your plan,
you would most likely have git-status _and_ git-commit both in C
at about the same time when you finish.
> I'm definitely in favor.
>
>> Will commit
>> modified: Makefile (warning: further changed)
>
> I like it (the double-mention of files which were changed, updated, then
> changed has always bothered me). However, I'm not sure how we can get
> the diff machinery to figure this out easily. Getting the knowledge for
> the line above requires diffing tree to cache and cache to working
> directory. Is there a better way than saving the queue from one diff and
> cross-referencing it with the other?
I do not think so. I was initially planning to write a new
traversal function that walks working tree, index _and_ a tree
in parallel, but that would not work well with -M and -C, so I
dropped it.
^ permalink raw reply
* Re: [RFC] diff: support custom callbacks for output
From: Jeff King @ 2006-08-07 9:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vr6zt3oz5.fsf@assigned-by-dhcp.cox.net>
On Mon, Aug 07, 2006 at 01:54:38AM -0700, Junio C Hamano wrote:
> "output format" in the form of a callback hook is a very good
> idea. I am not sure if a callback per filepair is a good
> interface, or passing the q (that is &diff_queued_diff) and let
> the hook iterate over it might be better, though. It probably
> would not be such a big deal either way.
Looking through the diff_flush code, many of the formats want to do
something slightly more interesting than simply looping (and one would
assume that any gitlib users might want to do similar things), so I
think passing q makes more sense. As a bonus, it helps avoid contortions
like:
void my_callback(...) {
static int header_shown = 0;
if (!header_shown) ... /* make sure we show header exactly once iff
we have any diff items */
header_shown = 1;
}
One could, of course, implement the current diff output formats as
callbacks. I'm not sure if it's worth the effort, though, as we
currently support multiple simultaneous outputs (which the flags do
fine, but which would require a list of callbacks).
> Having said that, I am wondering how much of "git status" you
> are doing in C. Initially, I was going to do the whole thing
> (one good reason to do so is that then we do not have to write
> out a temporary index file; we can do everything in-core.
> However I came to realize it is quite a big undertaking. In
I'm starting by writing run_status in C. Once that is working (which
should be soon), I believe it should suffice as a vanilla git-status
(do people actually do things like git-status with flags? It's not
documented, but it does work). My plan is:
1. get working builtin git-status
2. remove git-status from git-commit.sh
3. naively replace run_status with call to git-status, with
git-commit handling things like TMP_INDEX
4. one by one, expand git-status options to handle special cases
from git-commit.sh
> the initial commit) and the working tree files. The program
> would run (internally) diff-index --cached, diff-files and
> ls-files -o to do "Will commit", "Changed" and "Untracked".
Yes, that is step 1 above (and is almost done -- I needed to figure out
this diff interface first).
> By the way, I was pondering about making the git status output a
> bit more readable by making it shorter. Instead of listing the
I'm definitely in favor.
> Will commit
> modified: Makefile (warning: further changed)
I like it (the double-mention of files which were changed, updated, then
changed has always bothered me). However, I'm not sure how we can get
the diff machinery to figure this out easily. Getting the knowledge for
the line above requires diffing tree to cache and cache to working
directory. Is there a better way than saving the queue from one diff and
cross-referencing it with the other?
-Peff
^ permalink raw reply
* Re: [RFC] diff: support custom callbacks for output
From: Junio C Hamano @ 2006-08-07 8:54 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20060807075002.GA29693@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I'm re-writing git-status in C, and that entails using the git library
> to replace calls to things like git-diff-index. Fortunately,
> run_diff_index does just what I want. Unfortunately, it ends up wanting
> to send its output to stdout in one of the pre-defined diff formats, and
> what I really want is my own status format.
Good. I then can stop the same I've been doing in "pu" ;-).
> I could, of course, add diff_flush_status() support to diffcore.
> However, I'm not sure that it really belongs there. In the interests of
> libification, it seems reasonable for diffcore to provide a callback
> mechanism for each filepair.
>
> Below is an attempt to provide such a mechanism. My questions are:
> 1. Am I right that there is no other way to accomplish this task? This
> is my first interaction with diffcore, so I might have overlooked
> something.
What I was going to do was to give a hook to run_diff_index()
and friends, to be called just before diff_flush(). Then the
hook can inspect the diff_queued_diff for the result. Obviously
you do not want diff_flush() to say anything, so you would call
it with no-output option. But I think adding a new generic
"output format" in the form of a callback hook is a very good
idea. I am not sure if a callback per filepair is a good
interface, or passing the q (that is &diff_queued_diff) and let
the hook iterate over it might be better, though. It probably
would not be such a big deal either way.
Having said that, I am wondering how much of "git status" you
are doing in C. Initially, I was going to do the whole thing
(one good reason to do so is that then we do not have to write
out a temporary index file; we can do everything in-core.
However I came to realize it is quite a big undertaking. In
order to handle -o, you would need to run diff-files (to make
sure the index is clean at specified paths), discard_cache() and
read-tree (to re-read the HEAD commit tree), update-index with
ls-files like pathspec (to update the index at specified paths),
then do "diff-index --cached" (to say "Will commit"),
"diff-files" (to say "Changed"), and "ls-files -o"
("Untracked").
If you are planning to go the whole nine yards, more power to
you ;-), but a less ambitious fallback position would be to
rewrite only git-commit.sh::run_status() in C. That is, let the
current git-commit.sh drive the parts to prepare TMP_INDEX (or
NEXT_INDEX), and write a C program that uses the given index
(most likely specified by GIT_INDEX_FILE environment variable by
the caller -- git-commit.sh), REFERENCE (probably given as a
parameter, usually HEAD but HEAD^1 while --amend and nothing if
the initial commit) and the working tree files. The program
would run (internally) diff-index --cached, diff-files and
ls-files -o to do "Will commit", "Changed" and "Untracked".
By the way, I was pondering about making the git status output a
bit more readable by making it shorter. Instead of listing the
same file in "Updated but not checked in" and "Changed but not
updated" sections twice, it might be more alarming and concise
to say:
Will commit
modified: Makefile (warning: further changed)
modified: foo.c
Changed
modified: bar.c
Untracked
baz.c
^ permalink raw reply
* Re: [RFC] gitweb test script
From: Matthias Lederhofer @ 2006-08-07 8:31 UTC (permalink / raw)
To: git
In-Reply-To: <20060806165151.GB9548@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> wrote:
> +TOPDIR="`pwd``git rev-parse --show-cdup`"
This should be
TOPDIR="`pwd`/`git rev-parse --show-cdup`"
^ permalink raw reply
* Re: fast-import and unique objects.
From: Ryan Anderson @ 2006-08-07 7:57 UTC (permalink / raw)
To: Shawn Pearce; +Cc: Jon Smirl, git
In-Reply-To: <20060806180323.GA19120@spearce.org>
On Sun, Aug 06, 2006 at 02:03:24PM -0400, Shawn Pearce wrote:
>
> - It expects an estimated object count as its second parameter.
> In your case this would be something around 760000. This tells
> it how large of an object table to allocate, with each entry
> being 24 bytes + 1 pointer (28 or 32 bytes). Overshooting
> this number will cause it to degrade by allocating one
> overflow entry at a time from malloc.
Hrm, you're allocating a big table and then assigning consecutive
entries out of it, as pointers.
Why not just malloc a big block, and assign offsets into it, as if it
were a really big array. Every time it runs out, realloc it to double
the current size, and update the base pointer.
--
Ryan Anderson
sometimes Pug Majere
^ 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