git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.
@ 2008-12-02 15:15 Mark Burton
  2008-12-02 15:30 ` Shawn O. Pearce
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Burton @ 2008-12-02 15:15 UTC (permalink / raw)
  To: git

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>
---

 This patch stops git-gui from annoying git-push when the remote is a
 mirror. A further enhancement would be to disable the branch names list
 in the dialog when the selected destination is a mirror. As it stands, you can
 select a branch name from the list but it will be ignored (this could possibly
 confuse/annoy people). But that's a bunch more work so I'm stopping here for
 now.

 git-gui/lib/transport.tcl |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index e419d78..b18d9c7 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -33,10 +33,15 @@ proc push_to {remote} {
 proc start_push_anywhere_action {w} {
 	global push_urltype push_remote push_url push_thin push_tags
 	global push_force
+	global repo_config
 
+	set is_mirror 0
 	set r_url {}
 	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}
 	}
 	if {$r_url eq {}} return
@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} {
 		lappend cmd --tags
 	}
 	lappend cmd $r_url
-	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
+	if {$is_mirror} {
+		set cons [console::new \
+			[mc "push %s" $r_url] \
+			[mc "Mirroring to %s" $r_url]]
 	} 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 \
-		[mc "push %s" $r_url] \
-		[mc "Pushing %s %s to %s" $cnt $unit $r_url]]
+		set cons [console::new \
+			[mc "push %s" $r_url] \
+			[mc "Pushing %s %s to %s" $cnt $unit $r_url]]
+	}
 	console::exec $cons $cmd
 	destroy $w
 }
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.
  2008-12-02 15:15 [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror Mark Burton
@ 2008-12-02 15:30 ` Shawn O. Pearce
  2008-12-02 16:31   ` Mark Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2008-12-02 15:30 UTC (permalink / raw)
  To: Mark Burton; +Cc: git

Mark Burton <markb@ordern.com> wrote:
> 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>

Thanks.

>  This patch stops git-gui from annoying git-push when the remote is a
>  mirror. A further enhancement would be to disable the branch names list
>  in the dialog when the selected destination is a mirror. As it stands, you can
>  select a branch name from the list but it will be ignored (this could possibly
>  confuse/annoy people). But that's a bunch more work so I'm stopping here for
>  now.

Yea, it is a chunk of work.  I thought about trying to do it myself
right now, but realized I won't be able to do it in 15 minutes and
gave up.  :-)

Unfortunately this patch adds a new string to be translated and I've
already made a request for the translators to update their languages,
and several have.  I'll send out another request to let them know
there's this new string; we should have enough time before 1.6.1
goes final.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.
  2008-12-02 15:30 ` Shawn O. Pearce
@ 2008-12-02 16:31   ` Mark Burton
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Burton @ 2008-12-02 16:31 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git


Hi Shawn,

> Yea, it is a chunk of work.  I thought about trying to do it myself
> right now, but realized I won't be able to do it in 15 minutes and
> gave up.  :-)

Well, when you/someone looks at updating the push dialog you could
consider adding another checkbox that disables the refspec so that the
push uses whatever default refspec has been configured. I think that would
be a useful addition.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-02 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 15:15 [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror Mark Burton
2008-12-02 15:30 ` Shawn O. Pearce
2008-12-02 16:31   ` Mark Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).