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

Enhanced diff options for gitk (Re: --unified=0)

From
RLRay Lehtiniemi <rayl@mail.com>
Date
Feb 3, 2007, 22:12 UTC
Message-ID
<200702031512.52778.rayl@mail.com>
In-Reply-To
<7virej3rkt.fsf@assigned-by-dhcp.cox.net>
On Saturday 03 February 2007 13:37, Junio C Hamano wrote:
> That's sick.
:-)  i actually only noticed it while testing this patch....
 
-- >8 --
[PATCH] Enhanced diff options for gitk.

The diff options box in the gitk preferences dialog doesn't do much because the GIT_DIFF_OPTS environment variable only honors the --unified option.

Adjust the usage of $diffopts and remove GIT_DIFF_OPTS from gitk so that other diff options will be honored.

Signed-off-by: Ray Lehtiniemi <rayl@mail.com>
---
 gitk |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gitk b/gitk
index 68cfd63..7ee19b7 100755
--- a/gitk
+++ b/gitk
@@ -4183,9 +4183,7 @@ proc mergediff {id l} {
 
     set diffmergeid $id
     set diffids $id
-    # this doesn't seem to actually affect anything...
-    set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [concat | git diff-tree --no-commit-id --cc $id]
+    set cmd [concat | git diff-tree $diffopts --no-commit-id --cc $id]
     if {[catch {set mdf [open $cmd r]} err]} {
 	error_popup "Error getting merge diffs: $err"
 	return
@@ -4332,8 +4330,7 @@ proc getblobdiffs {ids} {
     global diffopts blobdifffd diffids env curdifftag curtagstart
     global nextupdate diffinhdr treediffs
 
-    set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [concat | git diff-tree --no-commit-id -r -p -C $ids]
+    set cmd [concat | git diff-tree $diffopts --no-commit-id -r -p -C $ids]
     if {[catch {set bdf [open $cmd r]} err]} {
 	puts "error getting diffs: $err"
 	return
@@ -5896,7 +5893,7 @@ proc prefscan {} {
 }
 
 proc prefsok {} {
-    global maxwidth maxgraphpct
+    global maxwidth maxgraphpct diffopts
     global oldprefs prefstop showneartags
 
     catch {destroy $prefstop}
@@ -5906,6 +5903,8 @@ proc prefsok {} {
 	redisplay
     } elseif {$showneartags != $oldprefs(showneartags)} {
 	reselectline
+    } elseif {$diffopts != $oldprefs(diffopts)} {
+	reselectline
     }
 }
 
@@ -6188,7 +6187,7 @@ proc tcl_encoding {enc} {
 
 # defaults...
 set datemode 0
-set diffopts "-U 5 -p"
+set diffopts ""
 set wrcomcmd "git diff-tree --stdin -p --pretty"
 
 set gitencoding {}
-- 
1.5.0.rc3.28.g8bbd
Previous: Junio C Hamano
Message 3 of 3 in “a slight anomaly in '--unified=0' diff output for one particular commit?”
  1. Ray LehtiniemiFeb 2, 2007
  2. Junio C HamanoFeb 3, 2007
  3. Enhanced diff options for gitk (Re: --unified=0)Ray Lehtiniemi, Feb 3, 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.