git-gui: correct spelling errors in comments
[gitweb.git] / lib / remote.tcl
index 817ca1b6a3b5cb2ee2616d60cbaaa263387c4906..4e5c7844188ee2eab0c9f6e00835b99c69bbdfc2 100644 (file)
@@ -233,37 +233,41 @@ proc make_sure_remote_submenues_exist {remote_m} {
 proc update_all_remotes_menu_entry {} {
        global all_remotes
 
+       if {[git-version < 1.6.6]} { return }
+
        set have_remote 0
        foreach r $all_remotes {
-               set have_remote 1
+               incr have_remote
        }
 
        set remote_m .mbar.remote
        set fetch_m $remote_m.fetch
        set prune_m $remote_m.prune
-       if {$have_remote} {
+       if {$have_remote > 1} {
                make_sure_remote_submenues_exist $remote_m
-               if {[$fetch_m entrycget 0 -label] ne "All"} {
+               if {[$fetch_m type end] eq "command" \
+                       && [$fetch_m entrycget end -label] ne "All"} {
 
-                       $fetch_m insert 0 separator
-                       $fetch_m insert 0 command \
+                       $fetch_m insert end separator
+                       $fetch_m insert end command \
                                -label "All" \
                                -command fetch_from_all
 
-                       $prune_m insert 0 separator
-                       $prune_m insert 0 command \
-                               -label "All" \
+                       $prune_m insert end separator
+                       $prune_m insert end command \
+                               -label "All" \
                                -command prune_from_all
                }
        } else {
                if {[winfo exists $fetch_m]} {
-                       if {[$fetch_m type end] eq "separator"} {
+                       if {[$fetch_m type end] eq "command" \
+                               && [$fetch_m entrycget end -label] eq "All"} {
 
-                               delete_from_menu $fetch_m 0
-                               delete_from_menu $fetch_m 0
+                               delete_from_menu $fetch_m end
+                               delete_from_menu $fetch_m end
 
-                               delete_from_menu $prune_m 0
-                               delete_from_menu $prune_m 0
+                               delete_from_menu $prune_m end
+                               delete_from_menu $prune_m end
                        }
                }
        }