git-gui: Don't kill modified commit message buffer with merge templates
authorShawn O. Pearce <spearce@spearce.org>
Fri, 27 Jul 2007 06:30:15 +0000 (02:30 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 27 Jul 2007 06:30:15 +0000 (02:30 -0400)
If the user is in the middle of a merge and has already started to
modify their commit message we were losing the user's changes when
they pressed 'Rescan' after resolving issues or making changes in
the working directory.

The problem here was our background timer that saves the commit
message buffer. It marks the commit message buffer as not being
modified when it writes it out to disk, so during the rescan we
assumed the buffer should be replaced with what we read from the
MERGE_MSG file. So we now only read these files from .git if we
have a valid backup file. Since we clear it on commit this will
only have an impact while the user is actively editing the current
commit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh
index a38293a347d12bf717c0e02638e465d9efc06c4c..f87b955fdb98bdd0591c9c02c52075e245cc2e19 100755 (executable)
@@ -829,8 +829,9 @@ proc rescan {after {honor_trustmtime 1}} {
 
        array unset file_states
 
-       if {![$ui_comm edit modified]
-               || [string trim [$ui_comm get 0.0 end]] eq {}} {
+       if {!$::GITGUI_BCK_exists &&
+               (![$ui_comm edit modified]
+               || [string trim [$ui_comm get 0.0 end]] eq {})} {
                if {[string match amend* $commit_type]} {
                } elseif {[load_message GITGUI_MSG]} {
                } elseif {[load_message MERGE_MSG]} {