git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff
@ 2006-10-26  8:50 Jakub Narebski
  2006-10-26  8:59 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2006-10-26  8:50 UTC (permalink / raw)
  To: git

Use --no-commit-id option to git-diff-tree command in git_commit and
git_commitdiff to filter out commit ID output that git-diff-tree adds
when called with only one <tree-ish> (not only for --stdin). Remove
filtering commit IDs from git-diff-tree output.

This option is in git since at least v1.0.0, so make use of it.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d7034b4..35a9afb 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3133,14 +3133,12 @@ sub git_commit {
 	if (!defined $parent) {
 		$parent = "--root";
 	}
-	open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, $parent, $hash
+	open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
+		@diff_opts, $parent, $hash
 		or die_error(undef, "Open git-diff-tree failed");
 	my @difftree = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading git-diff-tree failed");
 
-	# filter out commit ID output
-	@difftree = grep(!/^[0-9a-fA-F]{40}$/, @difftree);
-
 	# non-textual hash id's can be cached
 	my $expires;
 	if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
@@ -3453,15 +3451,14 @@ sub git_commitdiff {
 	my @difftree;
 	if ($format eq 'html') {
 		open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
+			"--no-commit-id",
 			"--patch-with-raw", "--full-index", $hash_parent, $hash
 			or die_error(undef, "Open git-diff-tree failed");
 
 		while (chomp(my $line = <$fd>)) {
 			# empty line ends raw part of diff-tree output
 			last unless $line;
-			# filter out commit ID output
-			push @difftree, $line
-				unless $line =~ m/^[0-9a-fA-F]{40}$/;
+			push @difftree, $line;
 		}
 
 	} elsif ($format eq 'plain') {
-- 
1.4.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff
  2006-10-26  8:50 [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff Jakub Narebski
@ 2006-10-26  8:59 ` Junio C Hamano
  2006-10-26  9:37   ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-10-26  8:59 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Use --no-commit-id option to git-diff-tree command in git_commit and
> git_commitdiff to filter out commit ID output that git-diff-tree adds
> when called with only one <tree-ish> (not only for --stdin). Remove
> filtering commit IDs from git-diff-tree output.
>
> This option is in git since at least v1.0.0, so make use of it.

*BLUSH*

I think we would need something like this, if only for
completeness.

-- >8 --
[PATCH] combine-diff: honour --no-commit-id

Somehow we forgot to look at no_commit_id flag in these
codepaths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 combine-diff.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index 01a8437..8ff46e8 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -737,7 +737,7 @@ static void show_patch_diff(struct combi
 		int added = 0;
 		int deleted = 0;
 
-		if (rev->loginfo)
+		if (rev->loginfo && !rev->no_commit_id)
 			show_log(rev, opt->msg_sep);
 		dump_quoted_path(dense ? "diff --cc " : "diff --combined ",
 				 elem->path, c_meta, c_reset);
@@ -815,7 +815,7 @@ static void show_raw_diff(struct combine
 	if (!line_termination)
 		inter_name_termination = 0;
 
-	if (rev->loginfo)
+	if (rev->loginfo && !rev->no_commit_id)
 		show_log(rev, opt->msg_sep);
 
 	if (opt->output_format & DIFF_FORMAT_RAW) {
@@ -887,7 +887,7 @@ void diff_tree_combined(const unsigned c
 	diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
 	diffopts.recursive = 1;
 
-	show_log_first = !!rev->loginfo;
+	show_log_first = !!rev->loginfo && !rev->no_commit_id;
 	needsep = 0;
 	/* find set of paths that everybody touches */
 	for (i = 0; i < num_parent; i++) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff
  2006-10-26  8:59 ` Junio C Hamano
@ 2006-10-26  9:37   ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-10-26  9:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Use --no-commit-id option to git-diff-tree command in git_commit and
> > git_commitdiff to filter out commit ID output that git-diff-tree adds
> > when called with only one <tree-ish> (not only for --stdin). Remove
> > filtering commit IDs from git-diff-tree output.
> >
> > This option is in git since at least v1.0.0, so make use of it.
> 
> *BLUSH*
> 
> I think we would need something like this, if only for
> completeness.
> 
> -- >8 --
> [PATCH] combine-diff: honour --no-commit-id
> 
> Somehow we forgot to look at no_commit_id flag in these
> codepaths.

It's good that I haven't started coding support for combined commitdiff
in gitweb, as I would probably wonder why the code doesn't work ;-)
-- 
Jakub Narebski

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-26  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26  8:50 [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff Jakub Narebski
2006-10-26  8:59 ` Junio C Hamano
2006-10-26  9:37   ` Jakub Narebski

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).