git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH] git-gui: Modify push dialog to support Gerrit review

From
JEJørgen Edelbo <jed@napatech.com>
Date
Sep 6, 2013, 08:17 UTC
Message-ID
<F8C23E99F5C6884EB99E2A1966D743637F361D2A@cph-gen-exch01.napatech.com>
In-Reply-To
<xmqqioyfjhok.fsf@gitster.dls.corp.google.com>
Junio C Hamano < gitster@pobox.com> writes:
> Isn't the right way to improve the situation to let the command line tools
> know how the user wants to push things out and just have Git-GUI delegate
> the choice to the underlying "git push"?
Thank you for all the constructive feedback. I realize that it is not the way forward to remove the selection of branches to push.
What I consider now, is to pursue the idea that Junio presents above: just let the gui tool use whatever is configured for the selected remote. I have, however not been able to come up with a solution that looks nice. What I have been trying now is the following little modification:
diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index e5d211e..1709464 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -95,7 +95,9 @@ proc start_push_anywhere_action {w} {
                set cnt 0
                foreach i [$w.source.l curselection] {
                        set b [$w.source.l get $i]
-                       lappend cmd "refs/heads/$b:refs/heads/$b"
+                       if {$b nw {<default>}}{
+                               lappend cmd "refs/heads/$b:refs/heads/$b"
+                       }
                        incr cnt
                }
                if {$cnt == 0} {
@@ -149,6 +151,7 @@ proc do_push_anywhere {} {
                -height 10 \
                -width 70 \
                -selectmode extended
+       $w.source.l insert end <default>
        foreach h [load_all_heads] {
                $w.source.l insert end $h
                if {$h eq $current_branch} {

The idea is to insert a "<default>" entry in the branch selection list, and then skip that when building the command. Then you can avoid having refs on the command line and just let git act according to configuration.

How about that? Any smarter way to do it?

BR Jørgen
Previous: Junio C HamanoNext: Heiko Voigt
Message 9 of 11 in “git-gui: Modify push dialog to support Gerrit review”
  1. git-gui: Modify push dialog to support Gerrit reviewJoergen Edelbo, Sep 2, 2013
  2. Heiko VoigtSep 5, 2013
  3. Johannes SixtSep 5, 2013
  4. Jørgen EdelboSep 5, 2013
  5. Johannes SixtSep 5, 2013
  6. Jørgen EdelboSep 5, 2013
  7. Johannes SixtSep 5, 2013
  8. Junio C HamanoSep 5, 2013
  9. Jørgen EdelboSep 6, 2013
  10. Heiko VoigtSep 5, 2013
  11. Junio C HamanoSep 5, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.