@matheusbsbs / matheus-bagliano / commits / 861c68e3b6
Fork 0

git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.

When the destination repository is a mirror, this function goofed by still passing a refspec to git-push. Now it notices that the remote is a mirror and holds the refspec. Signed-off-by: Mark Burton <markb@ordern.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Mark Burton committed Dec 2, 2008 at 15:15 UTC 861c68e3b6a8d10af5517e6750a66407d32105aa
1 file changed +27 -16
lib/transport.tcl
+27 -16
@@ -33,10 +33,15 @@ proc push_to {remote} {
33 proc start_push_anywhere_action {w} {
34 global push_urltype push_remote push_url push_thin push_tags
35 global push_force
36 + global repo_config
37
38 + set is_mirror 0
39 set r_url {}
40 switch -- $push_urltype {
39 - remote {set r_url $push_remote}
41 + remote {
42 + set r_url $push_remote
43 + catch {set is_mirror $repo_config(remote.$push_remote.mirror)}
44 + }
45 url {set r_url $push_url}
46 }
47 if {$r_url eq {}} return
@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} {
58 lappend cmd --tags
59 }
60 lappend cmd $r_url
56 - set cnt 0
57 - foreach i [$w.source.l curselection] {
58 - set b [$w.source.l get $i]
59 - lappend cmd "refs/heads/$b:refs/heads/$b"
60 - incr cnt
61 - }
62 - if {$cnt == 0} {
63 - return
64 - } elseif {$cnt == 1} {
65 - set unit branch
61 + if {$is_mirror} {
62 + set cons [console::new \
63 + [mc "push %s" $r_url] \
64 + [mc "Mirroring to %s" $r_url]]
65 } else {
67 - set unit branches
68 - }
66 + set cnt 0
67 + foreach i [$w.source.l curselection] {
68 + set b [$w.source.l get $i]
69 + lappend cmd "refs/heads/$b:refs/heads/$b"
70 + incr cnt
71 + }
72 + if {$cnt == 0} {
73 + return
74 + } elseif {$cnt == 1} {
75 + set unit branch
76 + } else {
77 + set unit branches
78 + }
79
70 - set cons [console::new \
71 - [mc "push %s" $r_url] \
72 - [mc "Pushing %s %s to %s" $cnt $unit $r_url]]
80 + set cons [console::new \
81 + [mc "push %s" $r_url] \
82 + [mc "Pushing %s %s to %s" $cnt $unit $r_url]]
83 + }
84 console::exec $cons $cmd
85 destroy $w
86 }