{"thread":{"id":"16559","subject":"[PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.","startedAt":"2008-12-02T15:15:02Z","lastAt":"2008-12-02T16:31:04Z","messageCount":3,"participants":["Mark Burton","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"96948","messageId":"20081202151502.3f30ced4@crow","threadId":"16559","inReplyTo":null,"subject":"[PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.","fromName":"Mark Burton","fromEmail":"markb@ordern.com","sentAt":"2008-12-02T15:15:02Z","receivedAt":"2008-12-02T15:15:02Z","isPatch":true,"sender":{"key":"markb@ordern.com","avatar":null},"body":"When the destination repository is a mirror, this function goofed by still\npassing a refspec to git-push. Now it notices that the remote is a mirror\nand holds the refspec.\n\nSigned-off-by: Mark Burton <markb@ordern.com>\n---\n\n This patch stops git-gui from annoying git-push when the remote is a\n mirror. A further enhancement would be to disable the branch names list\n in the dialog when the selected destination is a mirror. As it stands, you can\n select a branch name from the list but it will be ignored (this could possibly\n confuse/annoy people). But that's a bunch more work so I'm stopping here for\n now.\n\n git-gui/lib/transport.tcl |   43 +++++++++++++++++++++++++++----------------\n 1 files changed, 27 insertions(+), 16 deletions(-)\n\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex e419d78..b18d9c7 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -33,10 +33,15 @@ proc push_to {remote} {\n proc start_push_anywhere_action {w} {\n \tglobal push_urltype push_remote push_url push_thin push_tags\n \tglobal push_force\n+\tglobal repo_config\n \n+\tset is_mirror 0\n \tset r_url {}\n \tswitch -- $push_urltype {\n-\tremote {set r_url $push_remote}\n+\tremote {\n+\t\tset r_url $push_remote\n+\t\tcatch {set is_mirror $repo_config(remote.$push_remote.mirror)}\n+\t}\n \turl {set r_url $push_url}\n \t}\n \tif {$r_url eq {}} return\n@@ -53,23 +58,29 @@ proc start_push_anywhere_action {w} {\n \t\tlappend cmd --tags\n \t}\n \tlappend cmd $r_url\n-\tset cnt 0\n-\tforeach i [$w.source.l curselection] {\n-\t\tset b [$w.source.l get $i]\n-\t\tlappend cmd \"refs/heads/$b:refs/heads/$b\"\n-\t\tincr cnt\n-\t}\n-\tif {$cnt == 0} {\n-\t\treturn\n-\t} elseif {$cnt == 1} {\n-\t\tset unit branch\n+\tif {$is_mirror} {\n+\t\tset cons [console::new \\\n+\t\t\t[mc \"push %s\" $r_url] \\\n+\t\t\t[mc \"Mirroring to %s\" $r_url]]\n \t} else {\n-\t\tset unit branches\n-\t}\n+\t\tset cnt 0\n+\t\tforeach i [$w.source.l curselection] {\n+\t\t\tset b [$w.source.l get $i]\n+\t\t\tlappend cmd \"refs/heads/$b:refs/heads/$b\"\n+\t\t\tincr cnt\n+\t\t}\n+\t\tif {$cnt == 0} {\n+\t\t\treturn\n+\t\t} elseif {$cnt == 1} {\n+\t\t\tset unit branch\n+\t\t} else {\n+\t\t\tset unit branches\n+\t\t}\n \n-\tset cons [console::new \\\n-\t\t[mc \"push %s\" $r_url] \\\n-\t\t[mc \"Pushing %s %s to %s\" $cnt $unit $r_url]]\n+\t\tset cons [console::new \\\n+\t\t\t[mc \"push %s\" $r_url] \\\n+\t\t\t[mc \"Pushing %s %s to %s\" $cnt $unit $r_url]]\n+\t}\n \tconsole::exec $cons $cmd\n \tdestroy $w\n }\n-- \n1.6.0.4\n"},{"id":"96950","messageId":"20081202153007.GJ23984@spearce.org","threadId":"16559","inReplyTo":"20081202151502.3f30ced4@crow","subject":"Re: [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-12-02T15:30:07Z","receivedAt":"2008-12-02T15:30:07Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Mark Burton <markb@ordern.com> wrote:\n> When the destination repository is a mirror, this function goofed by still\n> passing a refspec to git-push. Now it notices that the remote is a mirror\n> and holds the refspec.\n> \n> Signed-off-by: Mark Burton <markb@ordern.com>\n\nThanks.\n\n>  This patch stops git-gui from annoying git-push when the remote is a\n>  mirror. A further enhancement would be to disable the branch names list\n>  in the dialog when the selected destination is a mirror. As it stands, you can\n>  select a branch name from the list but it will be ignored (this could possibly\n>  confuse/annoy people). But that's a bunch more work so I'm stopping here for\n>  now.\n\nYea, it is a chunk of work.  I thought about trying to do it myself\nright now, but realized I won't be able to do it in 15 minutes and\ngave up.  :-)\n\nUnfortunately this patch adds a new string to be translated and I've\nalready made a request for the translators to update their languages,\nand several have.  I'll send out another request to let them know\nthere's this new string; we should have enough time before 1.6.1\ngoes final.\n\n-- \nShawn.\n"},{"id":"96961","messageId":"20081202163104.29306f22@crow","threadId":"16559","inReplyTo":"20081202153007.GJ23984@spearce.org","subject":"Re: [PATCH] git-gui: Teach start_push_anywhere_action{} to notice when remote is a mirror.","fromName":"Mark Burton","fromEmail":"markb@ordern.com","sentAt":"2008-12-02T16:31:04Z","receivedAt":"2008-12-02T16:31:04Z","isPatch":true,"sender":{"key":"markb@ordern.com","avatar":null},"body":"\nHi Shawn,\n\n> Yea, it is a chunk of work.  I thought about trying to do it myself\n> right now, but realized I won't be able to do it in 15 minutes and\n> gave up.  :-)\n\nWell, when you/someone looks at updating the push dialog you could\nconsider adding another checkbox that disables the refspec so that the\npush uses whatever default refspec has been configured. I think that would\nbe a useful addition.\n\nCheers,\n\nMark\n"}]}