]> git.ipfire.org Git - thirdparty/git.git/blame - git-gui/lib/branch.tcl
Merge branch 'bc/run-command-nullness-after-free-fix' into maint
[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]
39acfa3d 11 fconfigure $fd -translation binary -encoding utf-8
f522c9b5 12 while {[gets $fd line] > 0} {
6f2a3fc8
SP
13 if {!$some_heads_tracking || ![is_tracking_branch $line]} {
14 lappend all_heads [string range $line $rh_len end]
15 }
f522c9b5
SP
16 }
17 close $fd
18
d41b43eb 19 return [lsort $all_heads]
f522c9b5
SP
20}
21
22proc load_all_tags {} {
23 set all_tags [list]
0b812616
SP
24 set fd [git_read for-each-ref \
25 --sort=-taggerdate \
26 --format=%(refname) \
27 refs/tags]
39acfa3d 28 fconfigure $fd -translation binary -encoding utf-8
f522c9b5
SP
29 while {[gets $fd line] > 0} {
30 if {![regsub ^refs/tags/ $line {} name]} continue
31 lappend all_tags $name
32 }
33 close $fd
560eddc0 34 return $all_tags
f522c9b5
SP
35}
36
f522c9b5
SP
37proc radio_selector {varname value args} {
38 upvar #0 $varname var
39 set var $value
40}