summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a977953)
raw | patch | inline | side by side (parent: a977953)
author | Paul Mackerras <paulus@samba.org> | |
Mon, 26 May 2008 00:11:33 +0000 (10:11 +1000) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Mon, 26 May 2008 00:11:33 +0000 (10:11 +1000) |
This draws the currently checked-out head with a yellow circle, as
suggested by Linus Torvalds, and fixes various places in the code
where we assumed that the current head always had a branch. Now we
can display the fake commits for local changes on a detached head.
Signed-off-by: Paul Mackerras <paulus@samba.org>
suggested by Linus Torvalds, and fixes various places in the code
where we assumed that the current head always had a branch. Now we
can display the fake commits for local changes on a detached head.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index 22bcd18a4671b3bdd78f065c65bdaf042ba4a77e..fddcb45817ed6839ba95965d7e57e9a2e04ae30a 100755 (executable)
--- a/gitk
+++ b/gitk
global startmsecs commitidx viewcomplete curview
global commfd leftover tclencoding
global viewargs viewargscmd viewfiles vfilelimit
- global showlocalchanges commitinterest mainheadid
+ global showlocalchanges commitinterest
global viewactive loginstance viewinstances vmergeonly
global pending_select mainheadid
global vcanopt vflags vrevs vorigargs
set viewinstances($view) [list $i]
set commfd($i) $fd
set leftover($i) {}
- if {$showlocalchanges} {
+ if {$showlocalchanges && $mainheadid ne {}} {
lappend commitinterest($mainheadid) {dodiffindex}
}
fconfigure $fd -blocking 0 -translation lf -eofchar {}
proc updatecommits {} {
global curview vcanopt vorigargs vfilelimit viewinstances
- global viewactive viewcomplete loginstance tclencoding mainheadid
+ global viewactive viewcomplete loginstance tclencoding
global startmsecs commfd showneartags showlocalchanges leftover
global mainheadid pending_select
global isworktree
if {$viewcomplete($curview)} {
global commitidx varctok
global numcommits startmsecs
- global mainheadid nullid
if {[info exists pending_select]} {
set row [first_real_row]
set mainhead {}
set mainheadid {}
catch {
+ set mainheadid [exec git rev-parse HEAD]
set thehead [exec git symbolic-ref HEAD]
if {[string match "refs/heads/*" $thehead]} {
set mainhead [string range $thehead 11 end]
- if {[info exists headids($mainhead)]} {
- set mainheadid $headids($mainhead)
- }
}
}
}
proc doshowlocalchanges {} {
global curview mainheadid
+ if {$mainheadid eq {}} return
if {[commitinview $mainheadid $curview]} {
dodiffindex
} else {
global cmitlisted commitinfo rowidlist parentlist
global rowtextx idpos idtags idheads idotherrefs
global linehtag linentag linedtag selectedline
- global canvxmax boldrows boldnamerows fgcolor nullid nullid2
+ global canvxmax boldrows boldnamerows fgcolor
+ global mainheadid nullid nullid2 circleitem circlecolors
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
set listed $cmitlisted($curview,$id)
set ofill red
} elseif {$id eq $nullid2} {
set ofill green
+ } elseif {$id eq $mainheadid} {
+ set ofill yellow
} else {
- set ofill [expr {$listed != 0 ? $listed == 2 ? "gray" : "blue" : "white"}]
+ set ofill [lindex $circlecolors $listed]
}
set x [xc $row $col]
set y [yc $row]
[expr {$x - $orad}] [expr {$y + $orad - 1}] \
-fill $ofill -outline $fgcolor -width 1 -tags circle]
}
+ set circleitem($row) $t
$canv raise $t
$canv bind $t <1> {selcanvline {} %x %y}
set rmx [llength [lindex $rowidlist $row]]
}
proc redrawtags {id} {
- global canv linehtag idpos currentid curview
- global canvxmax iddrawn
+ global canv linehtag idpos currentid curview cmitlisted
+ global canvxmax iddrawn circleitem mainheadid circlecolors
if {![commitinview $id $curview]} return
if {![info exists iddrawn($id)]} return
set row [rowofcommit $id]
+ if {$id eq $mainheadid} {
+ set ofill yellow
+ } else {
+ set ofill [lindex $circlecolors $cmitlisted($curview,$id)]
+ }
+ $canv itemconf $circleitem($row) -fill $ofill
$canv delete tag.$id
set xt [eval drawtags $id $idpos($id)]
$canv coords $linehtag($row) $xt [lindex $idpos($id) 2]
if {$mainhead ne {}} {
movehead $newhead $mainhead
movedhead $newhead $mainhead
- set mainheadid $newhead
}
+ set mainheadid $newhead
redrawtags $oldhead
redrawtags $newhead
selbyid $newhead
}
proc cobranch {} {
- global headmenuid headmenuhead mainhead headids
+ global headmenuid headmenuhead headids
global showlocalchanges mainheadid
# check the tree is clean first??
if {[catch {close $fd} err]} {
error_popup $err
}
- set oldmainhead $mainhead
+ set oldmainid $mainheadid
set mainhead $newhead
set mainheadid $newheadid
- if {[info exists headids($oldmainhead)]} {
- redrawtags $headids($oldmainhead)
- }
+ redrawtags $oldmainid
redrawtags $newheadid
selbyid $newheadid
if {$showlocalchanges} {
[array names idheads] [array names idotherrefs]]]
foreach id $refids {
set v [listrefs $id]
- if {![info exists ref($id)] || $ref($id) != $v ||
- ($id eq $oldmainhead && $id ne $mainheadid) ||
- ($id eq $mainheadid && $id ne $oldmainhead)} {
+ if {![info exists ref($id)] || $ref($id) != $v} {
redrawtags $id
}
}
+ if {$oldmainhead ne $mainheadid} {
+ redrawtags $oldmainhead
+ redrawtags $mainheadid
+ }
run refill_reflist
}
set ignorespace 0
set selectbgcolor gray85
+set circlecolors {white blue gray blue blue}
+
## For msgcat loading, first locate the installation location.
if { [info exists ::env(GITK_MSGSDIR)] } {
## Msgsdir was manually set in the environment.