]> git.ipfire.org Git - thirdparty/git.git/blame - git-gui/lib/branch.tcl
Merge git://repo.or.cz/git-gui
[thirdparty/git.git] / git-gui / lib / branch.tcl
CommitLineData
f522c9b5
SP
1# git-gui branch (create/delete) support
2# Copyright (C) 2006, 2007 Shawn Pearce
3
4proc load_all_heads {} {
6f2a3fc8 5 global some_heads_tracking
f522c9b5 6
6f2a3fc8
SP
7 set rh refs/heads
8 set rh_len [expr {[string length $rh] + 1}]
f522c9b5 9 set all_heads [list]
0b812616 10 set fd [git_read for-each-ref --format=%(refname) $rh]
f522c9b5 11 while {[gets $fd line] > 0} {
6f2a3fc8
SP
12 if {!$some_heads_tracking || ![is_tracking_branch $line]} {
13 lappend all_heads [string range $line $rh_len end]
14 }
f522c9b5
SP
15 }
16 close $fd
17
d41b43eb 18 return [lsort $all_heads]
f522c9b5
SP
19}
20
21proc load_all_tags {} {
22 set all_tags [list]
0b812616
SP
23 set fd [git_read for-each-ref \
24 --sort=-taggerdate \
25 --format=%(refname) \
26 refs/tags]
f522c9b5
SP
27 while {[gets $fd line] > 0} {
28 if {![regsub ^refs/tags/ $line {} name]} continue
29 lappend all_tags $name
30 }
31 close $fd
560eddc0 32 return $all_tags
f522c9b5
SP
33}
34
f522c9b5
SP
35proc radio_selector {varname value args} {
36 upvar #0 $varname var
37 set var $value
38}