git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/6] gitweb: Add parsing of raw combined diff format to parse_difftree_raw_line

From
Jakub Narebski <jnareb@gmail.com>
Date
May 6, 2007, 23:10 UTC
Message-ID
<11784930111140-git-send-email-jnareb@gmail.com>
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
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 12 in “gitweb: Add combined diff support”
  1. 0/6 gitweb: Add combined diff supportJakub Narebski, May 6, 2007
  2. 1/6 gitweb: Add parsing of raw combined diff format to parse_difftree_raw_lineJakub Narebski, May 6, 2007
  3. 2/6 gitweb: Add combined diff support to git_difftree_bodyJakub Narebski, May 6, 2007
  4. 3/6 gitweb: Add combined diff support to git_patchset_bodyJakub Narebski, May 6, 2007
  5. 4/6 gitweb: Make it possible to use pre-parsed info in git_difftree_bodyJakub Narebski, May 6, 2007
  6. 5/6 gitweb: Show combined diff for merge commits in 'commitdiff' viewJakub Narebski, May 6, 2007
  7. 6/6 gitweb: Show combined diff for merge commits in 'commit' viewJakub Narebski, May 6, 2007
  8. 7/6 todo: Remove "Gitweb diff on merge commits" entryJakub Narebski, May 6, 2007
  9. Junio C HamanoMay 8, 2007
  10. Jakub NarebskiMay 8, 2007
  11. 7/6 gitweb: Empty patch for merge means trivial merge, not no differencesJakub Narebski, May 16, 2007
  12. Junio C HamanoMay 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.