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

Re: [RFD] Strange patch formats (aka tricks with unified diffs)..

From
Paul Mackerras <paulus@samba.org>
Date
Apr 18, 2007, 01:44 UTC
Message-ID
<17957.30706.398078.689096@cargo.ozlabs.ibm.com>
In-Reply-To
<Pine.LNX.4.64.0704130812390.28042@woody.linux-foundation.org>
Linus Torvalds writes:
Show 5 quoted lines
> Ok, just a radio button for the patch case for "show patch" vs "show 
> result" would certainly be sufficient for what I normally do. Adding the 
> case "show origin" for completeness (ie filter out the new lines, rather 
> than filtering out the old lines) is probably a good idea, even if I've 
> never used it.
Try this patch, let me know what you think...
Paul.
diff --git a/gitk b/gitk
index b1c65d7..a57e84c 100755
--- a/gitk
+++ b/gitk
@@ -593,6 +593,7 @@ proc makewindow {} {
         frame .bleft -width $geometry(botwidth) -height $geometry(botheight)
     }
     frame .bleft.top
+    frame .bleft.mid
 
     button .bleft.top.search -text "Search" -command dosearch \
 	-font $uifont
@@ -602,12 +603,20 @@ proc makewindow {} {
     lappend entries $sstring
     trace add variable searchstring write incrsearch
     pack $sstring -side left -expand 1 -fill x
+    radiobutton .bleft.mid.diff -text "Diff" \
+	-command changediffdisp -variable diffelide -value {0 0}
+    radiobutton .bleft.mid.old -text "Old version" \
+	-command changediffdisp -variable diffelide -value {0 1}
+    radiobutton .bleft.mid.new -text "New version" \
+	-command changediffdisp -variable diffelide -value {1 0}
+    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
     set ctext .bleft.ctext
     text $ctext -background $bgcolor -foreground $fgcolor \
 	-state disabled -font $textfont \
 	-yscrollcommand scrolltext -wrap none
     scrollbar .bleft.sb -command "$ctext yview"
     pack .bleft.top -side top -fill x
+    pack .bleft.mid -side top -fill x
     pack .bleft.sb -side right -fill y
     pack $ctext -side left -fill both -expand 1
     lappend bglist $ctext
@@ -4486,6 +4495,13 @@ proc getblobdiffline {bdf ids} {
     }
 }
 
+proc changediffdisp {} {
+    global ctext diffelide
+
+    $ctext tag conf d0 -elide [lindex $diffelide 0]
+    $ctext tag conf d1 -elide [lindex $diffelide 1]
+}
+
 proc prevfile {} {
     global difffilestart ctext
     set prev [lindex $difffilestart 0]
@@ -6330,6 +6346,7 @@ set highlight_paths {}
 set searchdirn -forwards
 set boldrows {}
 set boldnamerows {}
+set diffelide {0 0}
 
 set optim_delay 16
 
Previous: Linus TorvaldsNext: Linus Torvalds
Message 13 of 16 in “[RFD] Strange patch formats (aka tricks with unified diffs)..”
  1. Linus TorvaldsApr 12, 2007
  2. Junio C HamanoApr 12, 2007
  3. Marco CostalbaApr 13, 2007
  4. Marco CostalbaApr 17, 2007
  5. Paul MackerrasApr 13, 2007
  6. Martin LanghoffApr 13, 2007
  7. Junio C HamanoApr 13, 2007
  8. Martin LanghoffApr 13, 2007
  9. Johannes SchindelinApr 14, 2007
  10. Junio C HamanoApr 14, 2007
  11. Jeff KingApr 14, 2007
  12. Linus TorvaldsApr 13, 2007
  13. Paul MackerrasApr 18, 2007
  14. Linus TorvaldsApr 18, 2007
  15. Matthias LederhoferApr 13, 2007
  16. Linus TorvaldsApr 13, 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.