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

[PATCH 7/8] git-gui: handle special content lines only in the diff header section

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Dec 9, 2010, 20:47 UTC
Message-ID
<6581252c19fb2c89a7f2d3e77e62b32f689d5e38.1291927657.git.bert.wesarg@googlemail.com>
In-Reply-To
<83035737417287ef9f1ad246e269f0e31dbe5e03.1291927657.git.bert.wesarg@googlemail.com>
These two also stop the diff header.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 lib/diff.tcl |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 91ed7c6..4eaf7e7 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -400,7 +400,14 @@ proc read_diff {fd conflict_size cont_info} {
 		if {[string match {@@@ *} $line]} {set is_3way_diff 1}
 
 		if {$::current_diff_inheader} {
-			append current_diff_header $line "\n"
+
+			# -- These two lines stop a diff header and shouldn't be in there
+			if {   [string match {Binary files * and * differ} $line]
+			    || [regexp {^\* Unmerged path }                $line]} {
+				set ::current_diff_inheader 0
+			} else {
+				append current_diff_header $line "\n"
+			}
 
 			# -- Cleanup uninteresting diff header lines.
 			#
@@ -418,16 +425,12 @@ proc read_diff {fd conflict_size cont_info} {
 			regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line
 		}
 
-
-
 		if {[string match {new file *} $line]
 			|| [regexp {^(old|new) mode *} $line]
 			|| [string match {deleted file *} $line]
 			|| [string match {deleted symlink} $line]
 			|| [string match {new symlink} $line]
-			|| [string match {Binary files * and * differ} $line]
-			|| $line eq {\ No newline at end of file}
-			|| [regexp {^\* Unmerged path } $line]} {
+			|| $line eq {\ No newline at end of file}} {
 		} elseif {$is_3way_diff} {
 			set op [string range $line 0 1]
 			switch -- $op {
-- 
1.7.3.2.1200.ge4bf6
Previous: Bert WesargNext: Bert Wesarg
Message 7 of 9 in “git-gui: rework handling of diff header”
  1. 1/8 git-gui: rework handling of diff headerBert Wesarg, Dec 9, 2010
  2. 2/8 git-gui: handle index lines only in the diff headerBert Wesarg, Dec 9, 2010
  3. 3/8 git-gui: name also new symlinks soBert Wesarg, Dec 9, 2010
  4. 4/8 git-gui: there is no "mode *" diff header lineBert Wesarg, Dec 9, 2010
  5. 5/8 git-gui: move 3way diff autodetect upBert Wesarg, Dec 9, 2010
  6. 6/8 git-gui: always reset the current tagBert Wesarg, Dec 9, 2010
  7. 7/8 git-gui: handle special content lines only in the diff header sectionBert Wesarg, Dec 9, 2010
  8. 8/8 git-gui: handle meta diff header lines only in the header sectionBert Wesarg, Dec 9, 2010
  9. Pat ThoytsJan 28, 2011

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.