提交 861c68e3 编写于 作者: M Mark Burton 提交者: Shawn O. Pearce

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: NMark Burton <markb@ordern.com>
Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
上级 6249067c
...@@ -33,10 +33,15 @@ proc push_to {remote} { ...@@ -33,10 +33,15 @@ proc push_to {remote} {
proc start_push_anywhere_action {w} { proc start_push_anywhere_action {w} {
global push_urltype push_remote push_url push_thin push_tags global push_urltype push_remote push_url push_thin push_tags
global push_force global push_force
global repo_config
set is_mirror 0
set r_url {} set r_url {}
switch -- $push_urltype { switch -- $push_urltype {
remote {set r_url $push_remote} remote {
set r_url $push_remote
catch {set is_mirror $repo_config(remote.$push_remote.mirror)}
}
url {set r_url $push_url} url {set r_url $push_url}
} }
if {$r_url eq {}} return if {$r_url eq {}} return
...@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} { ...@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} {
lappend cmd --tags lappend cmd --tags
} }
lappend cmd $r_url lappend cmd $r_url
set cnt 0 if {$is_mirror} {
foreach i [$w.source.l curselection] { set cons [console::new \
set b [$w.source.l get $i] [mc "push %s" $r_url] \
lappend cmd "refs/heads/$b:refs/heads/$b" [mc "Mirroring to %s" $r_url]]
incr cnt
}
if {$cnt == 0} {
return
} elseif {$cnt == 1} {
set unit branch
} else { } else {
set unit branches set cnt 0
} foreach i [$w.source.l curselection] {
set b [$w.source.l get $i]
lappend cmd "refs/heads/$b:refs/heads/$b"
incr cnt
}
if {$cnt == 0} {
return
} elseif {$cnt == 1} {
set unit branch
} else {
set unit branches
}
set cons [console::new \ set cons [console::new \
[mc "push %s" $r_url] \ [mc "push %s" $r_url] \
[mc "Pushing %s %s to %s" $cnt $unit $r_url]] [mc "Pushing %s %s to %s" $cnt $unit $r_url]]
}
console::exec $cons $cmd console::exec $cons $cmd
destroy $w destroy $w
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册