git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Fitzsimons <robfitz@273k.net>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] gitweb: Re-enable rev-list --parents for parse_commit.
Date: Wed, 27 Dec 2006 14:22:21 +0000	[thread overview]
Message-ID: <20061227142221.GC6558@localhost> (raw)
In-Reply-To: <empkcf$qp$1@sea.gmane.org>

Re-enable rev-list --parents for parse_commit which was removed in
(208b2dff95bb48682c351099023a1cbb0e1edf26).  rev-list --parents is not
just used to return the parent headers in the commit object, it
includes any grafts which are vaild for the commit.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---


> Actually --header output gives us original parents. Rewritten parents
> (available with --parents) include also grafts and shallow clone grafts.
> For parse_commit we want --parents, for parse_commits we don't want it
> because --parents affects --full-history.

Heres a patch the re-enables --parents for parse_commit.

Robert


 gitweb/gitweb.perl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 65fcdb0..da12be7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1271,7 +1271,7 @@ sub parse_tag {
 }
 
 sub parse_commit_text {
-	my ($commit_text) = @_;
+	my ($commit_text, $withparents) = @_;
 	my @commit_lines = split '\n', $commit_text;
 	my %co;
 
@@ -1281,13 +1281,12 @@ sub parse_commit_text {
 	if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
 		return;
 	}
-	$co{'id'} = $header;
-	my @parents;
+	($co{'id'}, my @parents) = split ' ', $header;
 	while (my $line = shift @commit_lines) {
 		last if $line eq "\n";
 		if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
 			$co{'tree'} = $1;
-		} elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
+		} elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
 			push @parents, $1;
 		} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
 			$co{'author'} = $1;
@@ -1373,12 +1372,13 @@ sub parse_commit {
 	local $/ = "\0";
 
 	open my $fd, "-|", git_cmd(), "rev-list",
+		"--parents",
 		"--header",
 		"--max-count=1",
 		$commit_id,
 		"--",
 		or die_error(undef, "Open git-rev-list failed");
-	%co = parse_commit_text(<$fd>);
+	%co = parse_commit_text(<$fd>, 1);
 	close $fd;
 
 	return %co;
-- 
1.4.4.3.g6934

      reply	other threads:[~2006-12-27 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-24 14:31 [PATCH 1/8] gitweb: Add parse_commits, used to bulk load commit objects Robert Fitzsimons
2006-12-24 14:31 ` [PATCH 2/8] gitweb: We do longer need the --parents flag in rev-list Robert Fitzsimons
2006-12-24 14:31   ` [PATCH 3/8] gitweb: Change summary, shortlog actions to use parse_commits Robert Fitzsimons
2006-12-24 14:31     ` [PATCH 4/8] gitweb: Change log action " Robert Fitzsimons
2006-12-24 14:31       ` [PATCH 5/8] gitweb: Change header search " Robert Fitzsimons
2006-12-24 14:31         ` [PATCH 6/8] gitweb: Change atom, rss actions " Robert Fitzsimons
2006-12-24 14:31           ` [PATCH 7/8] gitweb: Change history action " Robert Fitzsimons
2006-12-24 14:31             ` [PATCH 8/8] gitweb: Use rev-list --skip option Robert Fitzsimons
2006-12-25 22:49   ` [PATCH 2/8] gitweb: We do longer need the --parents flag in rev-list Jakub Narebski
2006-12-27 14:22     ` Robert Fitzsimons [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061227142221.GC6558@localhost \
    --to=robfitz@273k.net \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).