Now that git-gui has facilities to help users resolve conflicts, it makes sense to launch it from other gui tools when they happen. Signed-off-by: Alexander Gavrilov <angavrilov@xxxxxxxxx> --- gitk | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 1 deletions(-) diff --git a/gitk b/gitk index cfaf7a1..e84e109 100755 --- a/gitk +++ b/gitk @@ -7843,6 +7843,53 @@ proc mkbrgo {top} { } } +proc exec_citool {args {baseid {}}} { + global commitinfo env + + if {[info exists env(GIT_AUTHOR_NAME)]} { + set old_name $env(GIT_AUTHOR_NAME) + } + if {[info exists env(GIT_AUTHOR_EMAIL)]} { + set old_email $env(GIT_AUTHOR_EMAIL) + } + if {[info exists env(GIT_AUTHOR_DATE)]} { + set old_date $env(GIT_AUTHOR_DATE) + } + + if {$baseid ne {}} { + if {![info exists commitinfo($baseid)]} { + getcommit $baseid + } + set author [lindex $commitinfo($baseid) 1] + set date [lindex $commitinfo($baseid) 2] + if {[regexp {^\s*(\S.*\S|\S)\s*<(.*)>\s*$} \ + $author author name email] + && $date ne {}} { + set env(GIT_AUTHOR_NAME) $name + set env(GIT_AUTHOR_EMAIL) $email + set env(GIT_AUTHOR_DATE) $date + } + } + + eval exec git citool $args & + + if {[info exists old_name]} { + set env(GIT_AUTHOR_NAME) $old_name + } else { + unset env(GIT_AUTHOR_NAME) + } + if {[info exists old_email]} { + set env(GIT_AUTHOR_EMAIL) $old_email + } else { + unset env(GIT_AUTHOR_EMAIL) + } + if {[info exists old_date]} { + set env(GIT_AUTHOR_DATE) $old_date + } else { + unset env(GIT_AUTHOR_DATE) + } +} + proc cherrypick {} { global rowmenuid curview global mainhead mainheadid @@ -7861,7 +7908,17 @@ proc cherrypick {} { # no error occurs, and exec takes that as an indication of error... if {[catch {exec sh -c "git cherry-pick -r $rowmenuid 2>&1"} err]} { notbusy cherrypick - error_popup $err + if {[regexp -line \ + {Entry '(.*)' would be overwritten by merge} $err msg fname]} { + error_popup [mc "Cherry-pick failed: file '%s' had local modifications. +Your working directory is in an inconsistent state." $fname] + } elseif {[regexp -line {^CONFLICT \(.*\):} $err msg]} { + # Force citool to read MERGE_MSG + file delete [file join [gitdir] "GITGUI_MSG"] + exec_citool [list] $rowmenuid + } else { + error_popup $err + } return } set newhead [exec git rev-parse HEAD] -- 1.6.0.20.g6148bc -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html