Skip to content

Commit 7fe6834

Browse files
committed
Merge git://ozlabs.org/~paulus/gitk
* git://ozlabs.org/~paulus/gitk: gitk: Add visiblerefs option, which lists always-shown branches gitk: Catch mkdtemp errors gitk: Use mktemp -d to avoid predictable temporary directories gitk: Honor TMPDIR when viewing external diffs
2 parents ea0e524 + bde4a0f commit 7fe6834

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

gitk-git/gitk

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,7 @@ proc savestuff {w} {
27872787
global mainheadcirclecolor workingfilescirclecolor indexcirclecolor
27882788
global linkfgcolor circleoutlinecolor
27892789
global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
2790-
global hideremotes want_ttk maxrefs
2790+
global hideremotes want_ttk maxrefs visiblerefs
27912791
global config_file config_file_tmp
27922792

27932793
if {$stuffsaved} return
@@ -2813,6 +2813,7 @@ proc savestuff {w} {
28132813
puts $f [list set autosellen $autosellen]
28142814
puts $f [list set showneartags $showneartags]
28152815
puts $f [list set maxrefs $maxrefs]
2816+
puts $f [list set visiblerefs $visiblerefs]
28162817
puts $f [list set hideremotes $hideremotes]
28172818
puts $f [list set showlocalchanges $showlocalchanges]
28182819
puts $f [list set datetimeformat $datetimeformat]
@@ -3493,10 +3494,20 @@ proc flist_hl {only} {
34933494
}
34943495

34953496
proc gitknewtmpdir {} {
3496-
global diffnum gitktmpdir gitdir
3497+
global diffnum gitktmpdir gitdir env
34973498

34983499
if {![info exists gitktmpdir]} {
3499-
set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
3500+
if {[info exists env(GITK_TMPDIR)]} {
3501+
set tmpdir $env(GITK_TMPDIR)
3502+
} elseif {[info exists env(TMPDIR)]} {
3503+
set tmpdir $env(TMPDIR)
3504+
} else {
3505+
set tmpdir $gitdir
3506+
}
3507+
set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
3508+
if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
3509+
set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
3510+
}
35003511
if {[catch {file mkdir $gitktmpdir} err]} {
35013512
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
35023513
unset gitktmpdir
@@ -7025,7 +7036,7 @@ proc viewnextline {dir} {
70257036
# add a list of tag or branch names at position pos
70267037
# returns the number of names inserted
70277038
proc appendrefs {pos ids var} {
7028-
global ctext linknum curview $var maxrefs mainheadid
7039+
global ctext linknum curview $var maxrefs visiblerefs mainheadid
70297040

70307041
if {[catch {$ctext index $pos}]} {
70317042
return 0
@@ -7046,14 +7057,14 @@ proc appendrefs {pos ids var} {
70467057
if {[llength $tags] > $maxrefs} {
70477058
# If we are displaying heads, and there are too many,
70487059
# see if there are some important heads to display.
7049-
# Currently this means "master" and the current head.
7060+
# Currently that are the current head and heads listed in $visiblerefs option
70507061
set itags {}
70517062
if {$var eq "idheads"} {
70527063
set utags {}
70537064
foreach ti $tags {
70547065
set hname [lindex $ti 0]
70557066
set id [lindex $ti 1]
7056-
if {($hname eq "master" || $id eq $mainheadid) &&
7067+
if {([lsearch -exact $visiblerefs $hname] != -1 || $id eq $mainheadid) &&
70577068
[llength $itags] < $maxrefs} {
70587069
lappend itags $ti
70597070
} else {
@@ -12035,6 +12046,7 @@ set wrapcomment "none"
1203512046
set showneartags 1
1203612047
set hideremotes 0
1203712048
set maxrefs 20
12049+
set visiblerefs {"master"}
1203812050
set maxlinelen 200
1203912051
set showlocalchanges 1
1204012052
set limitdiffs 1

0 commit comments

Comments
 (0)