Code

git-gui: Unify wording to say "to stage" instead of "to add"
[git.git] / lib / merge.tcl
index 62434ff310f80c180a31ae3ba985c7db2c3182ba..f6a2df3c064b3132d7607211656a7aee53638881 100644 (file)
@@ -45,7 +45,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, stage the file, and commit to complete the current merge.  Only then can you begin another merge.
 "
                        unlock_index
                        return 0
@@ -81,17 +81,44 @@ method _visualize {} {
 }
 
 method _start {} {
-       global HEAD current_branch
+       global HEAD current_branch remote_url
 
        set name [_rev $this]
        if {$name eq {}} {
                return
        }
 
-       set cmd [list git merge $name]
-       set msg "Merging $current_branch and $name"
+       set spec [$w_rev get_tracking_branch]
+       set cmit [$w_rev get_commit]
+       set cmd [list git]
+       lappend cmd merge
+       lappend cmd --strategy=recursive
+
+       set fh [open [gitdir FETCH_HEAD] w]
+       fconfigure $fh -translation lf
+       if {$spec eq {}} {
+               set remote .
+               set branch $name
+               set stitle $branch
+       } else {
+               set remote $remote_url([lindex $spec 1])
+               if {[regexp {^[^:@]*@[^:]*:/} $remote]} {
+                       regsub {^[^:@]*@} $remote {} remote
+               }
+               set branch [lindex $spec 2]
+               set stitle "$branch of $remote"
+       }
+       regsub ^refs/heads/ $branch {} branch
+       puts $fh "$cmit\t\tbranch '$branch' of $remote"
+       close $fh
+
+       lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
+       lappend cmd HEAD
+       lappend cmd $cmit
+
+       set msg "Merging $current_branch and $stitle"
        ui_status "$msg..."
-       set cons [console::new "Merge" $cmd]
+       set cons [console::new "Merge" "merge $stitle"]
        console::exec $cons $cmd [cb _finish $cons]
 
        wm protocol $w WM_DELETE_WINDOW {}
@@ -192,16 +219,20 @@ You must finish amending this commit.
        if {![lock_index abort]} return
 
        if {[string match *merge* $commit_type]} {
-               set op merge
+               set op_question "Abort merge?
+
+Aborting the current merge will cause *ALL* uncommitted changes to be lost.
+
+Continue with aborting the current merge?"
        } else {
-               set op commit
-       }
+               set op_question "Reset changes?
 
-       if {[ask_popup "Abort $op?
+Resetting the changes will cause *ALL* uncommitted changes to be lost.
 
-Aborting the current $op will cause *ALL* uncommitted changes to be lost.
+Continue with resetting the current changes?"
+       }
 
-Continue with aborting the current $op?"] eq {yes}} {
+       if {[ask_popup $op_question] eq {yes}} {
                set fd [git_read read-tree --reset -u HEAD]
                fconfigure $fd -blocking 0 -translation binary
                fileevent $fd readable [namespace code [list _reset_wait $fd]]