@matheusbsbs / matheus-bagliano / commits / 54febd4fe6
Fork 0

git-gui: Internally allow fetch without storing for future pull support

This is actually just an underlying code improvement that has no user visible component yet. UI improvements to actually fetch and merge via an arbitrary remote with no tracking branches must still follow to make this change useful for the end-user. Our tracking branch specifications are a Tcl list of three components: - local tracking branch name - remote name/url - remote branch name/tag name This change just makes the first element optional. If it is an empty string we will run the fetch, but have the value be saved only into the special .git/FETCH_HEAD, where we can pick it up and use it for this one time operation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 20, 2007 at 04:10 UTC 54febd4fe62cc32b1337cd928af17a5a09624d74
1 file changed +11 -3
lib/checkout_op.tcl
+11 -3
@@ -66,14 +66,19 @@ method run {} {
66 set r_head [lindex $fetch_spec 2]
67 regsub ^refs/heads/ $r_head {} r_name
68
69 + set cmd [list git fetch $remote]
70 + if {$l_trck ne {}} {
71 + lappend cmd +$r_head:$l_trck
72 + } else {
73 + lappend cmd $r_head
74 + }
75 +
76 _toplevel $this {Refreshing Tracking Branch}
77 set w_cons [::console::embed \
78 $w.console \
79 "Fetching $r_name from $remote"]
80 pack $w.console -fill both -expand 1
74 - $w_cons exec \
75 - [list git fetch $remote +$r_head:$l_trck] \
76 - [cb _finish_fetch]
81 + $w_cons exec $cmd [cb _finish_fetch]
82
83 bind $w <$M1B-Key-w> break
84 bind $w <$M1B-Key-W> break
@@ -114,6 +119,9 @@ method _noop {} {}
119 method _finish_fetch {ok} {
120 if {$ok} {
121 set l_trck [lindex $fetch_spec 0]
122 + if {$l_trck eq {}} {
123 + set l_trck FETCH_HEAD
124 + }
125 if {[catch {set new_hash [git rev-parse --verify "$l_trck^0"]} err]} {
126 set ok 0
127 $w_cons insert "fatal: Cannot resolve $l_trck"