git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 1/6] gitweb: Add parsing of raw combined diff format to parse_difftree_raw_line
Date: Mon,  7 May 2007 01:10:03 +0200	[thread overview]
Message-ID: <11784930111140-git-send-email-jnareb@gmail.com> (raw)
In-Reply-To: <11784930091585-git-send-email-jnareb@gmail.com>

Add parsing line of raw combined diff ("git diff-tree -c/-cc" output)
as described in section "diff format for merges" in diff-format.txt
to parse_difftree_raw_line subroutine.

Returned hash (or hashref) has for combined diff 'nparents' key which
holds number of parents in a merge. At keys 'from_mode' and 'from_id'
there are arrayrefs holding modes and ids, respectively. There is no
'similarity' value, and there is only 'to_file' value and no
'from_file' value.

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ba5cc43..dfba399 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1495,6 +1495,17 @@ sub parse_difftree_raw_line {
 			$res{'file'} = unquote($7);
 		}
 	}
+	# '::100755 100755 100755 60e79ca1b01bc8b057abe17ddab484699a7f5fdb 94067cc5f73388f33722d52ae02f44692bc07490 94067cc5f73388f33722d52ae02f44692bc07490 MR	git-gui/git-gui.sh'
+	# combined diff (for merge commit)
+	elsif ($line =~ s/^(::+)((?:[0-7]{6} )+)((?:[0-9a-fA-F]{40} )+)([a-zA-Z]+)\t(.*)$//) {
+		$res{'nparents'}  = length($1);
+		$res{'from_mode'} = [ split(' ', $2) ];
+		$res{'to_mode'} = pop @{$res{'from_mode'}};
+		$res{'from_id'} = [ split(' ', $3) ];
+		$res{'to_id'} = pop @{$res{'from_id'}};
+		$res{'status'} = [ split('', $4) ];
+		$res{'to_file'} = unquote($5);
+	}
 	# 'c512b523472485aef4fff9e57b229d9d243c967f'
 	elsif ($line =~ m/^([0-9a-fA-F]{40})$/) {
 		$res{'commit'} = $1;
-- 
1.5.1.3

  reply	other threads:[~2007-05-06 23:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-06 23:10 [PATCH 0/6] gitweb: Add combined diff support Jakub Narebski
2007-05-06 23:10 ` Jakub Narebski [this message]
2007-05-06 23:10 ` [PATCH 2/6] gitweb: Add combined diff support to git_difftree_body Jakub Narebski
2007-05-06 23:10 ` [PATCH 3/6] gitweb: Add combined diff support to git_patchset_body Jakub Narebski
2007-05-06 23:10 ` [PATCH 4/6] gitweb: Make it possible to use pre-parsed info in git_difftree_body Jakub Narebski
2007-05-06 23:10 ` [PATCH 5/6] gitweb: Show combined diff for merge commits in 'commitdiff' view Jakub Narebski
2007-05-06 23:10 ` [PATCH 6/6] gitweb: Show combined diff for merge commits in 'commit' view Jakub Narebski
2007-05-06 23:10 ` [PATCH 7/6] todo: Remove "Gitweb diff on merge commits" entry Jakub Narebski
2007-05-08  1:31 ` [PATCH 0/6] gitweb: Add combined diff support Junio C Hamano
2007-05-08  1:50   ` Jakub Narebski
2007-05-16 22:05 ` [PATCH 7/6] gitweb: Empty patch for merge means trivial merge, not no differences Jakub Narebski
2007-05-16 22:08   ` Junio C Hamano

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=11784930111140-git-send-email-jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /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).