[GITK PATCH] gitk: fix direction of --left-right triangles

Subsystems: the rest

STALE3737d

2 messages, 1 author, 2016-06-15 · open the first message on its own page

[GITK PATCH] gitk: fix direction of --left-right triangles

From: Thomas Rast <hidden>
Date: 2016-06-15 22:47:08

c961b22 (gitk: Use git log and add support for --left-right,
2007-07-09) introduced --left-right support to gitk, but right from
the start, 'gitk --left-right A...B' oriented the triangles the wrong
way: commits coming from A had a triangle to the right, and vice
versa.  To fix this, we simply swap the triangles.  (Note that git-log
does it right.)

Noticed-by: Björn Steinbrink [off-list ref]
Signed-off-by: Thomas Rast <redacted>
---

Sorry for the double mail, I forgot to Cc the list in the first mail.

 gitk |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gitk b/gitk
index 4604c83..5be2a76 100755
--- a/gitk
+++ b/gitk
@@ -5689,16 +5689,16 @@ proc drawcmittext {id row col} {
     } elseif {$listed == 3} {
 	# triangle pointing left for left-side commits
 	set t [$canv create polygon \
-		   [expr {$x - $orad}] $y \
-		   [expr {$x + $orad - 1}] [expr {$y - $orad}] \
-		   [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
+		   [expr {$x + $orad - 1}] $y \
+		   [expr {$x - $orad}] [expr {$y - $orad}] \
+		   [expr {$x - $orad}] [expr {$y + $orad - 1}] \
 		   -fill $ofill -outline $fgcolor -width 1 -tags circle]
     } else {
 	# triangle pointing right for right-side commits
 	set t [$canv create polygon \
-		   [expr {$x + $orad - 1}] $y \
-		   [expr {$x - $orad}] [expr {$y - $orad}] \
-		   [expr {$x - $orad}] [expr {$y + $orad - 1}] \
+		   [expr {$x - $orad}] $y \
+		   [expr {$x + $orad - 1}] [expr {$y - $orad}] \
+		   [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
 		   -fill $ofill -outline $fgcolor -width 1 -tags circle]
     }
     set circleitem($row) $t
-- 
1.6.4.214.gb5b94

[PATCH v2] gitk: fix direction of symmetric difference in optimized mode

From: Thomas Rast <hidden>
Date: 2016-06-15 22:47:09

ee66e08 (gitk: Make updates go faster, 2008-05-09) implemented an
optimized mode where gitk parses the arguments with rev-parse, and
manually reads history in chunks.  As mentioned in the commit message,
symmetric differences are a problem there:

    One wrinkle is that we have to turn symmetric diff arguments (of the
    form a...b) back into symmetric diff form so that --left-right still
    works, as git rev parse turns a...b into a b ^merge_base(a,b).

However, git-rev-parse returns a...b in the swapped order

    b a ^merge_base(a,b)

This has been the case since at least 1f8115b (the state of master at
the time of the abovementioned ee66e08; Merge branch 'maint',
2008-05-08).  So gitk flipped the sides of symmetric differences
whenever it was in optimized mode.

Fix this by swapping the sides of the reconstruction code.

Signed-off-by: Thomas Rast <redacted>
---

This supersedes the older patch, which was simply wrong; the triangle
directions in the affected section are correct.

The confusing part of this, but also how I stumbled across the real
bug, was that I was playing with --show-all and that flipped the
direction *again*.  Turns out the option is not recognized by gitk and
lets it go back to unoptimized mode, where the bug does not exist.


 gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index 4604c83..e103dab 100755
--- a/gitk
+++ b/gitk
@@ -288,7 +288,7 @@ proc parseviewrevs {view revs} {
 	    if {$sdm != 2} {
 		lappend ret $id
 	    } else {
-		lset ret end [lindex $ret end]...$id
+		lset ret end $id...[lindex $ret end]
 	    }
 	    lappend pos $id
 	}
-- 
1.6.4.96.g577b
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help