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