@matheusbsbs / matheus-bagliano / commits / 51e7e568c0
Fork 0

git-gui: Show all fetched branches for remote pulls.

Loop through every remote.<name>.fetch entry and add it as a valid option in the Pull menu. This way users can pull any remote branch that they track, without needing to leave the gui. Its a rather crude work around for not having a full merge interface. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Dec 12, 2006 at 22:44 UTC 51e7e568c0a7854b2f93b86d6085695ce80053cc
1 file changed +9 -8
git-gui
+9 -8
@@ -1819,28 +1819,29 @@ proc populate_pull_menu {m} {
1819 global gitdir repo_config all_remotes disable_on_lock
1820
1821 foreach remote $all_remotes {
1822 - set rb {}
1822 + set rb_list [list]
1823 if {[array get repo_config remote.$remote.url] ne {}} {
1824 if {[array get repo_config remote.$remote.fetch] ne {}} {
1825 - regexp {^([^:]+):} \
1826 - [lindex $repo_config(remote.$remote.fetch) 0] \
1827 - line rb
1825 + foreach line $repo_config(remote.$remote.fetch) {
1826 + if {[regexp {^([^:]+):} $line line rb]} {
1827 + lappend rb_list $rb
1828 + }
1829 + }
1830 }
1831 } else {
1832 catch {
1833 set fd [open [file join $gitdir remotes $remote] r]
1834 while {[gets $fd line] >= 0} {
1835 if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
1834 - break
1836 + lappend rb_list $rb
1837 }
1838 }
1839 close $fd
1840 }
1841 }
1842
1841 - set rb_short $rb
1842 - regsub ^refs/heads/ $rb {} rb_short
1843 - if {$rb_short ne {}} {
1843 + foreach rb $rb_list {
1844 + regsub ^refs/heads/ $rb {} rb_short
1845 $m add command \
1846 -label "Branch $rb_short from $remote..." \
1847 -command [list pull_remote $remote $rb] \