Skip to content

Commit ed56049

Browse files
committed
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.
2 parents 521ae13 + 861c68e commit ed56049

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

git-gui/lib/transport.tcl

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ proc push_to {remote} {
3333
proc start_push_anywhere_action {w} {
3434
global push_urltype push_remote push_url push_thin push_tags
3535
global push_force
36+
global repo_config
3637

38+
set is_mirror 0
3739
set r_url {}
3840
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+
}
4045
url {set r_url $push_url}
4146
}
4247
if {$r_url eq {}} return
@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} {
5358
lappend cmd --tags
5459
}
5560
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]]
6665
} 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+
}
6979

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+
}
7384
console::exec $cons $cmd
7485
destroy $w
7586
}

0 commit comments

Comments
 (0)