+ if {$spec ne {} && $opt_fetch} {
+ set l_trck [lindex $spec 0]
+ set remote [lindex $spec 1]
+ set r_head [lindex $spec 2]
+ regsub ^refs/heads/ $r_head {} r_head
+
+ set c $w.fetch_trck
+ toplevel $c
+ wm title $c "Refreshing Tracking Branch"
+ wm geometry $c "+[winfo rootx $w]+[winfo rooty $w]"
+
+ set e [::console::embed \
+ $c.console \
+ "Fetching $r_head from $remote"]
+ pack $c.console -fill both -expand 1
+ $e exec \
+ [list git fetch $remote +$r_head:$l_trck] \
+ [cb _finish_fetch $newbranch $c $e]
+
+ bind $c <Visibility> [list grab $c]
+ bind $c <$M1B-Key-w> break
+ bind $c <$M1B-Key-W> break
+ wm protocol $c WM_DELETE_WINDOW [cb _noop]
+ } else {
+ _finish_create $this $newbranch
+ }
+}
+
+method _noop {} {}
+
+method _finish_fetch {newbranch c e ok} {
+ wm protocol $c WM_DELETE_WINDOW {}
+
+ if {$ok} {
+ destroy $c
+ _finish_create $this $newbranch
+ } else {
+ $e done $ok
+ button $c.close -text Close -command [list destroy $c]
+ pack $c.close -side bottom -anchor e -padx 10 -pady 10
+ }
+}
+
+method _finish_create {newbranch} {
+ global null_sha1 all_heads
+