]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-gui.sh
git-gui: Warn users before making an octopus merge
[git.git] / git-gui.sh
index 551c11c9f5bd5c613aadb9297ddd4e301b0f9587..dd8a408c644ad190cf69aa60f8d62a6a2ed625be 100755 (executable)
@@ -4,7 +4,7 @@ exec wish "$0" -- "$@"
 
 set appvers {@@GITGUI_VERSION@@}
 set copyright {
-Copyright © 2006, 2007 Shawn Pearce, Paul Mackerras.
+Copyright © 2006, 2007 Shawn Pearce, et. al.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -242,6 +242,8 @@ proc error_popup {msg} {
        if {[reponame] ne {}} {
                append title " ([reponame])"
        }
+       option add *Dialog.msg.font font_ui
+       option add *Button.font font_ui
        set cmd [list tk_messageBox \
                -icon error \
                -type ok \
@@ -258,6 +260,8 @@ proc warn_popup {msg} {
        if {[reponame] ne {}} {
                append title " ([reponame])"
        }
+       option add *Dialog.msg.font font_ui
+       option add *Button.font font_ui
        set cmd [list tk_messageBox \
                -icon warning \
                -type ok \
@@ -274,6 +278,8 @@ proc info_popup {msg {parent .}} {
        if {[reponame] ne {}} {
                append title " ([reponame])"
        }
+       option add *Dialog.msg.font font_ui
+       option add *Button.font font_ui
        tk_messageBox \
                -parent $parent \
                -icon info \
@@ -287,6 +293,8 @@ proc ask_popup {msg} {
        if {[reponame] ne {}} {
                append title " ([reponame])"
        }
+       option add *Dialog.msg.font font_ui
+       option add *Button.font font_ui
        return [tk_messageBox \
                -parent . \
                -icon question \
@@ -299,6 +307,11 @@ proc ask_popup {msg} {
 ##
 ## version check
 
+if {{--version} eq $argv || {version} eq $argv} {
+       puts "git-gui version $appvers"
+       exit
+}
+
 set req_maj 1
 set req_min 5
 
@@ -722,12 +735,9 @@ proc handle_empty_diff {} {
 
 [short_path $path] has no changes.
 
-The modification date of this file was updated
-by another application, but the content within
-the file was not changed.
+The modification date of this file was updated by another application, but the content within the file was not changed.
 
-A rescan will be automatically started to find
-other files which may have the same state."
+A rescan will be automatically started to find other files which may have the same state."
 
        clear_diff
        display_file $path __
@@ -1028,8 +1038,7 @@ proc load_last_commit {} {
        if {[llength $PARENT] == 0} {
                error_popup {There is nothing to amend.
 
-You are about to create the initial commit.
-There is no commit before this to amend.
+You are about to create the initial commit.  There is no commit before this to amend.
 }
                return
        }
@@ -1038,10 +1047,7 @@ There is no commit before this to amend.
        if {$curType eq {merge}} {
                error_popup {Cannot amend while merging.
 
-You are currently in the middle of a merge that
-has not been fully completed.  You cannot amend
-the prior commit unless you first abort the
-current merge activity.
+You are currently in the middle of a merge that has not been fully completed.  You cannot amend the prior commit unless you first abort the current merge activity.
 }
                return
        }
@@ -1061,8 +1067,8 @@ current merge activity.
                                        set enc [string tolower [string range $line 9 end]]
                                }
                        }
-                       fconfigure $fd -encoding $enc
-                       set msg [string trim [read $fd]]
+                       set msg [encoding convertfrom $enc [read $fd]]
+                       set msg [string trim $msg]
                        close $fd
                } err]} {
                error_popup "Error loading commit data for amend:\n\n$err"
@@ -1131,9 +1137,7 @@ proc commit_tree {} {
        } elseif {$commit_type ne $curType || $HEAD ne $curHEAD} {
                info_popup {Last scanned state does not match repository state.
 
-Another Git program has modified this repository
-since the last scan.  A rescan must be performed
-before another commit can be created.
+Another Git program has modified this repository since the last scan.  A rescan must be performed before another commit can be created.
 
 The rescan will be automatically started now.
 }
@@ -1154,8 +1158,7 @@ The rescan will be automatically started now.
                U? {
                        error_popup "Unmerged files cannot be committed.
 
-File [short_path $path] has merge conflicts.
-You must resolve them and add the file before committing.
+File [short_path $path] has merge conflicts.  You must resolve them and add the file before committing.
 "
                        unlock_index
                        return
@@ -1168,7 +1171,7 @@ File [short_path $path] cannot be committed by this program.
                }
                }
        }
-       if {!$files_ready} {
+       if {!$files_ready && ![string match *merge $curType]} {
                info_popup {No changes to commit.
 
 You must add at least 1 file before you can commit.
@@ -1264,6 +1267,23 @@ proc commit_committree {fd_wt curHEAD msg} {
                return
        }
 
+       # -- Verify this wasn't an empty change.
+       #
+       if {$commit_type eq {normal}} {
+               set old_tree [git rev-parse "$PARENT^{tree}"]
+               if {$tree_id eq $old_tree} {
+                       info_popup {No changes to commit.
+
+No files were modified by this commit and it was not a merge commit.
+
+A rescan will be automatically started now.
+}
+                       unlock_index
+                       rescan {set ui_status_value {No changes to commit.}}
+                       return
+               }
+       }
+
        # -- Build the message.
        #
        set msg_p [gitdir COMMIT_EDITMSG]
@@ -1271,21 +1291,15 @@ proc commit_committree {fd_wt curHEAD msg} {
        if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
                set enc utf-8
        }
-       fconfigure $msg_wt -encoding $enc -translation binary
-       puts -nonewline $msg_wt $msg
+       fconfigure $msg_wt -encoding binary -translation binary
+       puts -nonewline $msg_wt [encoding convertto $enc $msg]
        close $msg_wt
 
        # -- Create the commit.
        #
        set cmd [list git commit-tree $tree_id]
-       set parents [concat $PARENT $MERGE_HEAD]
-       if {[llength $parents] > 0} {
-               foreach p $parents {
-                       lappend cmd -p $p
-               }
-       } else {
-               # git commit-tree writes to stderr during initial commit.
-               lappend cmd 2>/dev/null
+       foreach p [concat $PARENT $MERGE_HEAD] {
+               lappend cmd -p $p
        }
        lappend cmd <$msg_p
        if {[catch {set cmt_id [eval exec $cmd]} err]} {
@@ -1303,10 +1317,11 @@ proc commit_committree {fd_wt curHEAD msg} {
        }
        set i [string first "\n" $msg]
        if {$i >= 0} {
-               append reflogm {: } [string range $msg 0 [expr {$i - 1}]]
+               set subject [string range $msg 0 [expr {$i - 1}]]
        } else {
-               append reflogm {: } $msg
+               set subject $msg
        }
+       append reflogm {: } $subject
        set cmd [list git update-ref -m $reflogm HEAD $cmt_id $curHEAD]
        if {[catch {eval exec $cmd} err]} {
                error_popup "update-ref failed:\n\n$err"
@@ -1315,14 +1330,6 @@ proc commit_committree {fd_wt curHEAD msg} {
                return
        }
 
-       # -- Make sure our current branch exists.
-       #
-       if {$commit_type eq {initial}} {
-               lappend all_heads $current_branch
-               set all_heads [lsort -unique $all_heads]
-               populate_branch_menu
-       }
-
        # -- Cleanup after ourselves.
        #
        catch {file delete $msg_p}
@@ -1358,6 +1365,14 @@ proc commit_committree {fd_wt curHEAD msg} {
 
        if {[is_enabled singlecommit]} do_quit
 
+       # -- Make sure our current branch exists.
+       #
+       if {$commit_type eq {initial}} {
+               lappend all_heads $current_branch
+               set all_heads [lsort -unique $all_heads]
+               populate_branch_menu
+       }
+
        # -- Update in memory status
        #
        set selected_commit_type new
@@ -1400,7 +1415,7 @@ proc commit_committree {fd_wt curHEAD msg} {
        unlock_index
        reshow_diff
        set ui_status_value \
-               "Changes committed as [string range $cmt_id 0 7]."
+               "Created commit [string range $cmt_id 0 7]: $subject"
 }
 
 ######################################################################
@@ -2099,7 +2114,10 @@ proc do_create_branch {} {
                -value head \
                -variable create_branch_revtype \
                -font font_ui
-       eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
+       set lbranchm [eval tk_optionMenu $w.from.head_m create_branch_head \
+               $all_heads]
+       $lbranchm configure -font font_ui
+       $w.from.head_m configure -font font_ui
        grid $w.from.head_r $w.from.head_m -sticky w
        set all_trackings [all_tracking_branches]
        if {$all_trackings ne {}} {
@@ -2109,9 +2127,11 @@ proc do_create_branch {} {
                        -value tracking \
                        -variable create_branch_revtype \
                        -font font_ui
-               eval tk_optionMenu $w.from.tracking_m \
+               set tbranchm [eval tk_optionMenu $w.from.tracking_m \
                        create_branch_trackinghead \
-                       $all_trackings
+                       $all_trackings]
+               $tbranchm configure -font font_ui
+               $w.from.tracking_m configure -font font_ui
                grid $w.from.tracking_r $w.from.tracking_m -sticky w
        }
        set all_tags [load_all_tags]
@@ -2122,9 +2142,11 @@ proc do_create_branch {} {
                        -value tag \
                        -variable create_branch_revtype \
                        -font font_ui
-               eval tk_optionMenu $w.from.tag_m \
+               set tagsm [eval tk_optionMenu $w.from.tag_m \
                        create_branch_tag \
-                       $all_tags
+                       $all_tags]
+               $tagsm configure -font font_ui
+               $w.from.tag_m configure -font font_ui
                grid $w.from.tag_r $w.from.tag_m -sticky w
        }
        radiobutton $w.from.exp_r \
@@ -2318,7 +2340,11 @@ proc do_delete_branch {} {
                -value head \
                -variable delete_branch_checktype \
                -font font_ui
-       eval tk_optionMenu $w.validate.head_m delete_branch_head $all_heads
+       set mergedlocalm [eval tk_optionMenu $w.validate.head_m \
+               delete_branch_head \
+               $all_heads]
+       $mergedlocalm configure -font font_ui
+       $w.validate.head_m configure -font font_ui
        grid $w.validate.head_r $w.validate.head_m -sticky w
        set all_trackings [all_tracking_branches]
        if {$all_trackings ne {}} {
@@ -2328,9 +2354,11 @@ proc do_delete_branch {} {
                        -value tracking \
                        -variable delete_branch_checktype \
                        -font font_ui
-               eval tk_optionMenu $w.validate.tracking_m \
+               set mergedtrackm [eval tk_optionMenu $w.validate.tracking_m \
                        delete_branch_trackinghead \
-                       $all_trackings
+                       $all_trackings]
+               $mergedtrackm configure -font font_ui
+               $w.validate.tracking_m configure -font font_ui
                grid $w.validate.tracking_r $w.validate.tracking_m -sticky w
        }
        radiobutton $w.validate.always_r \
@@ -2365,9 +2393,7 @@ proc switch_branch {new_branch} {
        } elseif {$commit_type ne $curType || $HEAD ne $curHEAD} {
                info_popup {Last scanned state does not match repository state.
 
-Another Git program has modified this repository
-since the last scan.  A rescan must be performed
-before the current branch can be changed.
+Another Git program has modified this repository since the last scan.  A rescan must be performed before the current branch can be changed.
 
 The rescan will be automatically started now.
 }
@@ -2458,12 +2484,9 @@ Staying on branch '$current_branch'."
        if {[catch {git symbolic-ref HEAD "refs/heads/$new_branch"} err]} {
                error_popup "Failed to set current branch.
 
-This working directory is only partially switched.
-We successfully updated your files, but failed to
-update an internal Git file.
+This working directory is only partially switched.  We successfully updated your files, but failed to update an internal Git file.
 
-This should not have occurred.  [appname] will now
-close and give up.
+This should not have occurred.  [appname] will now close and give up.
 
 $err"
                do_quit
@@ -2667,10 +2690,12 @@ proc do_push_anywhere {} {
        frame $w.buttons
        button $w.buttons.create -text Push \
                -font font_ui \
+               -default active \
                -command [list start_push_anywhere_action $w]
        pack $w.buttons.create -side right
        button $w.buttons.cancel -text {Cancel} \
                -font font_ui \
+               -default normal \
                -command [list destroy $w]
        pack $w.buttons.cancel -side right -padx 5
        pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -2704,7 +2729,10 @@ proc do_push_anywhere {} {
                        -value remote \
                        -variable push_urltype \
                        -font font_ui
-               eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes
+               set remmenu [eval tk_optionMenu $w.dest.remote_m push_remote \
+                       $all_remotes]
+               $remmenu configure -font font_ui
+               $w.dest.remote_m configure -font font_ui
                grid $w.dest.remote_r $w.dest.remote_m -sticky w
                if {[lsearch -sorted -exact $all_remotes origin] != -1} {
                        set push_remote origin
@@ -2758,8 +2786,9 @@ proc do_push_anywhere {} {
        set push_thin 0
        set push_tags 0
 
-       bind $w <Visibility> "grab $w"
+       bind $w <Visibility> "grab $w; focus $w.buttons.create"
        bind $w <Key-Escape> "destroy $w"
+       bind $w <Key-Return> [list start_push_anywhere_action $w]
        wm title $w "[appname] ([reponame]): Push"
        tkwait window $w
 }
@@ -2774,8 +2803,7 @@ proc can_merge {} {
        if {[string match amend* $commit_type]} {
                info_popup {Cannot merge while amending.
 
-You must finish amending this commit before
-starting any type of merge.
+You must finish amending this commit before starting any type of merge.
 }
                return 0
        }
@@ -2789,9 +2817,7 @@ starting any type of merge.
        if {$commit_type ne $curType || $HEAD ne $curHEAD} {
                info_popup {Last scanned state does not match repository state.
 
-Another Git program has modified this repository
-since the last scan.  A rescan must be performed
-before a merge can be performed.
+Another Git program has modified this repository since the last scan.  A rescan must be performed before a merge can be performed.
 
 The rescan will be automatically started now.
 }
@@ -2810,9 +2836,7 @@ The rescan will be automatically started now.
 
 File [short_path $path] has merge conflicts.
 
-You must resolve them, add the file, and commit to
-complete the current merge.  Only then can you
-begin another merge.
+You must resolve them, add the file, and commit to complete the current merge.  Only then can you begin another merge.
 "
                        unlock_index
                        return 0
@@ -2822,9 +2846,7 @@ begin another merge.
 
 File [short_path $path] is modified.
 
-You should complete the current commit before
-starting a merge.  Doing so will help you abort
-a failed merge, should the need arise.
+You should complete the current commit before starting a merge.  Doing so will help you abort a failed merge, should the need arise.
 "
                        unlock_index
                        return 0
@@ -2864,6 +2886,19 @@ proc start_local_merge_action {w} {
                set unit branch
        } elseif {$revcnt <= 15} {
                set unit branches
+
+               if {[tk_dialog \
+               $w.confirm_octopus \
+               [wm title $w] \
+               "Use octopus merge strategy?
+
+You are merging $revcnt branches at once.  This requires using the octopus merge driver, which may not succeed if there are file-level conflicts.
+" \
+               question \
+               0 \
+               {Cancel} \
+               {Use octopus} \
+               ] != 1} return
        } else {
                tk_messageBox \
                        -icon error \
@@ -2900,13 +2935,11 @@ proc finish_merge {revcnt w ok} {
 
 Your merge of $revcnt branches has failed.
 
-There are file-level conflicts between the
-branches which must be resolved manually.
+There are file-level conflicts between the branches which must be resolved manually.
 
 The working directory will now be reset.
 
-You can attempt this merge again
-by merging only one branch at a time." $w
+You can attempt this merge again by merging only one branch at a time." $w
 
                        set fd [open "| git read-tree --reset -u HEAD" r]
                        fconfigure $fd -blocking 0 -translation binary
@@ -3019,8 +3052,7 @@ You must finish amending this commit.
 
        if {[ask_popup "Abort $op?
 
-Aborting the current $op will cause
-*ALL* uncommitted changes to be lost.
+Aborting the current $op will cause *ALL* uncommitted changes to be lost.
 
 Continue with aborting the current $op?"] eq {yes}} {
                set fd [open "| git read-tree --reset -u HEAD" r]
@@ -3587,12 +3619,14 @@ proc read_blame_incremental {fd w w_load w_cmit w_line w_file} {
 proc blame_incremental_status {w} {
        global blame_status blame_data
 
+       set have  $blame_data($w,blame_lines)
+       set total $blame_data($w,total_lines)
+       set pdone 0
+       if {$total} {set pdone [expr {100 * $have / $total}]}
+
        set blame_status($w) [format \
                "Loading annotations... %i of %i lines annotated (%2i%%)" \
-               $blame_data($w,blame_lines) \
-               $blame_data($w,total_lines) \
-               [expr {100 * $blame_data($w,blame_lines)
-                       / $blame_data($w,total_lines)}]]
+               $have $total $pdone]
 }
 
 proc blame_click {w w_cmit w_line w_file cur_w pos} {
@@ -3643,6 +3677,20 @@ proc blame_showcommit {w w_cmit w_line w_file lno} {
                        incr i
                }
 
+               set author_name {}
+               set author_email {}
+               set author_time {}
+               catch {set author_name $blame_data($w,$cmit,author)}
+               catch {set author_email $blame_data($w,$cmit,author-mail)}
+               catch {set author_time [clock format $blame_data($w,$cmit,author-time)]}
+
+               set committer_name {}
+               set committer_email {}
+               set committer_time {}
+               catch {set committer_name $blame_data($w,$cmit,committer)}
+               catch {set committer_email $blame_data($w,$cmit,committer-mail)}
+               catch {set committer_time [clock format $blame_data($w,$cmit,committer-time)]}
+
                if {[catch {set msg $blame_data($w,$cmit,message)}]} {
                        set msg {}
                        catch {
@@ -3656,27 +3704,19 @@ proc blame_showcommit {w w_cmit w_line w_file lno} {
                                                set enc [string tolower [string range $line 9 end]]
                                        }
                                }
-                               fconfigure $fd -encoding $enc
-                               set msg [string trim [read $fd]]
+                               set msg [encoding convertfrom $enc [read $fd]]
+                               set msg [string trim $msg]
                                close $fd
+
+                               set author_name [encoding convertfrom $enc $author_name]
+                               set committer_name [encoding convertfrom $enc $committer_name]
+
+                               set blame_data($w,$cmit,author) $author_name
+                               set blame_data($w,$cmit,committer) $committer_name
                        }
                        set blame_data($w,$cmit,message) $msg
                }
 
-               set author_name {}
-               set author_email {}
-               set author_time {}
-               catch {set author_name $blame_data($w,$cmit,author)}
-               catch {set author_email $blame_data($w,$cmit,author-mail)}
-               catch {set author_time [clock format $blame_data($w,$cmit,author-time)]}
-
-               set committer_name {}
-               set committer_email {}
-               set committer_time {}
-               catch {set committer_name $blame_data($w,$cmit,committer)}
-               catch {set committer_email $blame_data($w,$cmit,committer-mail)}
-               catch {set committer_time [clock format $blame_data($w,$cmit,committer-time)]}
-
                $w_cmit insert end "commit $cmit\n"
                $w_cmit insert end "Author: $author_name $author_email $author_time\n"
                $w_cmit insert end "Committer: $committer_name $committer_email $committer_time\n"
@@ -4090,6 +4130,7 @@ proc console_done {args} {
                if {[winfo exists $w]} {
                        $w.m.s conf -background green -text {Success}
                        $w.ok conf -state normal
+                       focus $w.ok
                }
        } else {
                if {![winfo exists $w]} {
@@ -4097,6 +4138,7 @@ proc console_done {args} {
                }
                $w.m.s conf -background red -text {Error: Command Failed}
                $w.ok conf -state normal
+               focus $w.ok
        }
 
        array unset console_cr $w
@@ -4115,7 +4157,7 @@ proc do_gitk {revs} {
        # -- Always start gitk through whatever we were loaded with.  This
        #    lets us bypass using shell process on Windows systems.
        #
-       set cmd [info nameofexecutable]
+       set cmd [list [info nameofexecutable]]
        lappend cmd [gitexec gitk]
        if {$revs ne {}} {
                append cmd { }
@@ -4164,9 +4206,11 @@ proc do_stats {} {
        frame $w.buttons -border 1
        button $w.buttons.close -text Close \
                -font font_ui \
+               -default active \
                -command [list destroy $w]
        button $w.buttons.gc -text {Compress Database} \
                -font font_ui \
+               -default normal \
                -command "destroy $w;do_gc"
        pack $w.buttons.close -side right
        pack $w.buttons.gc -side left
@@ -4195,7 +4239,7 @@ proc do_stats {} {
        }
        pack $w.stat -pady 10 -padx 10
 
-       bind $w <Visibility> "grab $w; focus $w"
+       bind $w <Visibility> "grab $w; focus $w.buttons.close"
        bind $w <Key-Escape> [list destroy $w]
        bind $w <Key-Return> [list destroy $w]
        wm title $w "[appname] ([reponame]): Database Statistics"
@@ -4492,12 +4536,13 @@ proc do_about {} {
        frame $w.buttons
        button $w.buttons.close -text {Close} \
                -font font_ui \
+               -default active \
                -command [list destroy $w]
        pack $w.buttons.close -side right
        pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
        label $w.desc \
-               -text "git-gui - a commit creation tool for Git.
+               -text "git-gui - a graphical user interface for Git.
 $copyright" \
                -padx 5 -pady 5 \
                -justify left \
@@ -4537,8 +4582,9 @@ $copyright" \
                clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
        "
 
-       bind $w <Visibility> "grab $w; focus $w"
+       bind $w <Visibility> "grab $w; focus $w.buttons.close"
        bind $w <Key-Escape> "destroy $w"
+       bind $w <Key-Return> "destroy $w"
        bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
        wm title $w "About [appname]"
        tkwait window $w
@@ -4575,14 +4621,17 @@ proc do_options {} {
        frame $w.buttons
        button $w.buttons.restore -text {Restore Defaults} \
                -font font_ui \
+               -default normal \
                -command do_restore_defaults
        pack $w.buttons.restore -side left
        button $w.buttons.save -text Save \
                -font font_ui \
+               -default active \
                -command [list do_save_config $w]
        pack $w.buttons.save -side right
        button $w.buttons.cancel -text {Cancel} \
                -font font_ui \
+               -default normal \
                -command [list destroy $w]
        pack $w.buttons.cancel -side right -padx 5
        pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -4669,9 +4718,11 @@ proc do_options {} {
                frame $w.global.$name
                label $w.global.$name.l -text "$text:" -font font_ui
                pack $w.global.$name.l -side left -anchor w -fill x
-               eval tk_optionMenu $w.global.$name.family \
+               set fontmenu [eval tk_optionMenu $w.global.$name.family \
                        global_config_new(gui.$font^^family) \
-                       $all_fonts
+                       $all_fonts]
+               $w.global.$name.family configure -font font_ui
+               $fontmenu configure -font font_ui
                spinbox $w.global.$name.size \
                        -textvariable global_config_new(gui.$font^^size) \
                        -from 2 -to 80 -increment 1 \
@@ -4683,8 +4734,9 @@ proc do_options {} {
                pack $w.global.$name -side top -anchor w -fill x
        }
 
-       bind $w <Visibility> "grab $w; focus $w"
+       bind $w <Visibility> "grab $w; focus $w.buttons.save"
        bind $w <Key-Escape> "destroy $w"
+       bind $w <Key-Return> [list do_save_config $w]
        wm title $w "[appname] ([reponame]): Options"
        tkwait window $w
 }
@@ -5042,8 +5094,6 @@ enable_option branch
 enable_option transport
 
 switch -- $subcommand {
---version -
-version -
 browser -
 blame {
        disable_option multicommit
@@ -5068,18 +5118,18 @@ set ui_comm {}
 # -- Menu Bar
 #
 menu .mbar -tearoff 0
-.mbar add cascade -label Repository -menu .mbar.repository
-.mbar add cascade -label Edit -menu .mbar.edit
+.mbar add cascade -label Repository -menu .mbar.repository -font font_ui
+.mbar add cascade -label Edit -menu .mbar.edit -font font_ui
 if {[is_enabled branch]} {
-       .mbar add cascade -label Branch -menu .mbar.branch
+       .mbar add cascade -label Branch -menu .mbar.branch -font font_ui
 }
 if {[is_enabled multicommit] || [is_enabled singlecommit]} {
-       .mbar add cascade -label Commit -menu .mbar.commit
+       .mbar add cascade -label Commit -menu .mbar.commit -font font_ui
 }
 if {[is_enabled transport]} {
-       .mbar add cascade -label Merge -menu .mbar.merge
-       .mbar add cascade -label Fetch -menu .mbar.fetch
-       .mbar add cascade -label Push -menu .mbar.push
+       .mbar add cascade -label Merge -menu .mbar.merge -font font_ui
+       .mbar add cascade -label Fetch -menu .mbar.fetch -font font_ui
+       .mbar add cascade -label Push -menu .mbar.push -font font_ui
 }
 . configure -menu .mbar
 
@@ -5194,6 +5244,12 @@ if {[is_enabled branch]} {
                -font font_ui
        lappend disable_on_lock [list .mbar.branch entryconf \
                [.mbar.branch index last] -state]
+
+       .mbar.branch add command -label {Reset...} \
+               -command do_reset_hard \
+               -font font_ui
+       lappend disable_on_lock [list .mbar.branch entryconf \
+               [.mbar.branch index last] -state]
 }
 
 # -- Commit Menu
@@ -5268,6 +5324,34 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
                [list .mbar.commit entryconf [.mbar.commit index last] -state]
 }
 
+# -- Merge Menu
+#
+if {[is_enabled branch]} {
+       menu .mbar.merge
+       .mbar.merge add command -label {Local Merge...} \
+               -command do_local_merge \
+               -font font_ui
+       lappend disable_on_lock \
+               [list .mbar.merge entryconf [.mbar.merge index last] -state]
+       .mbar.merge add command -label {Abort Merge...} \
+               -command do_reset_hard \
+               -font font_ui
+       lappend disable_on_lock \
+               [list .mbar.merge entryconf [.mbar.merge index last] -state]
+
+}
+
+# -- Transport Menu
+#
+if {[is_enabled transport]} {
+       menu .mbar.fetch
+
+       menu .mbar.push
+       .mbar.push add command -label {Push...} \
+               -command do_push_anywhere \
+               -font font_ui
+}
+
 if {[is_MacOSX]} {
        # -- Apple Menu (Mac OS X only)
        #
@@ -5321,7 +5405,7 @@ if {[is_MacOSX]} {
 
 # -- Help Menu
 #
-.mbar add cascade -label Help -menu .mbar.help
+.mbar add cascade -label Help -menu .mbar.help -font font_ui
 menu .mbar.help
 
 if {![is_MacOSX]} {
@@ -5336,7 +5420,7 @@ set doc_path [file dirname [gitexec]]
 set doc_path [file join $doc_path Documentation index.html]
 
 if {[is_Cygwin]} {
-       set doc_path [exec cygpath --windows $doc_path]
+       set doc_path [exec cygpath --mixed $doc_path]
 }
 
 if {$browser eq {}} {
@@ -5380,11 +5464,6 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
 # -- Not a normal commit type invocation?  Do that instead!
 #
 switch -- $subcommand {
---version -
-version {
-       puts "git-gui version $appvers"
-       exit
-}
 browser {
        if {[llength $argv] != 1} {
                puts stderr "usage: $argv0 browser commit"
@@ -5416,7 +5495,7 @@ gui {
        # fall through to setup UI for commits
 }
 default {
-       puts stderr "usage: $argv0 \[{blame|citool}\]"
+       puts stderr "usage: $argv0 \[{blame|browser|citool}\]"
        exit 1
 }
 }
@@ -5440,28 +5519,6 @@ pack .branch.l1 -side left
 pack .branch.cb -side left -fill x
 pack .branch -side top -fill x
 
-if {[is_enabled branch]} {
-       menu .mbar.merge
-       .mbar.merge add command -label {Local Merge...} \
-               -command do_local_merge \
-               -font font_ui
-       lappend disable_on_lock \
-               [list .mbar.merge entryconf [.mbar.merge index last] -state]
-       .mbar.merge add command -label {Abort Merge...} \
-               -command do_reset_hard \
-               -font font_ui
-       lappend disable_on_lock \
-               [list .mbar.merge entryconf [.mbar.merge index last] -state]
-
-
-       menu .mbar.fetch
-
-       menu .mbar.push
-       .mbar.push add command -label {Push...} \
-               -command do_push_anywhere \
-               -font font_ui
-}
-
 # -- Main Window Layout
 #
 panedwindow .vpane -orient vertical
@@ -5931,7 +5988,7 @@ unset i
 set file_lists($ui_index) [list]
 set file_lists($ui_workdir) [list]
 
-wm title . "[appname] ([file normalize [file dirname [gitdir]]])"
+wm title . "[appname] ([reponame]) [file normalize [file dirname [gitdir]]]"
 focus -force $ui_comm
 
 # -- Warn the user about environmental problems.  Cygwin's Tcl
@@ -6010,9 +6067,7 @@ if {[is_enabled multicommit]} {
                if {[ask_popup \
                        "This repository currently has $objects_current loose objects.
 
-To maintain optimal performance it is strongly
-recommended that you compress the database
-when more than $object_limit loose objects exist.
+To maintain optimal performance it is strongly recommended that you compress the database when more than $object_limit loose objects exist.
 
 Compress the database now?"] eq yes} {
                        do_gc