@matheusbsbs / matheus-bagliano / commits / 21d7744fbc
Fork 0

git-gui: Don't save amended commit message buffer.

Because we don't automatically restart in amend mode when we quit while in amend mode the commit message buffer shouldn't be saved to GITGUI_MSG as it would be misleading when the user restarts the application. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 20, 2006 at 21:59 UTC 21d7744fbc98b526bc00138fce287565df2c0075
1 file changed +10 -8
git-gui
+10 -8
@@ -297,8 +297,8 @@ proc rescan {after} {
297 } elseif {[load_message MERGE_MSG]} {
298 } elseif {[load_message SQUASH_MSG]} {
299 }
300 - $ui_comm edit modified false
300 $ui_comm edit reset
301 + $ui_comm edit modified false
302 }
303
304 if {$repo_config(gui.trustmtime) eq {true}} {
@@ -750,8 +750,8 @@ current merge activity.
750
751 $ui_comm delete 0.0 end
752 $ui_comm insert end $msg
753 - $ui_comm edit modified false
753 $ui_comm edit reset
754 + $ui_comm edit modified false
755 rescan {set ui_status_value {Ready.}}
756 }
757
@@ -760,8 +760,8 @@ proc create_new_commit {} {
760
761 set commit_type normal
762 $ui_comm delete 0.0 end
763 - $ui_comm edit modified false
763 $ui_comm edit reset
764 + $ui_comm edit modified false
765 rescan {set ui_status_value {Ready.}}
766 }
767
@@ -1025,8 +1025,8 @@ proc commit_committree {fd_wt curHEAD msg} {
1025 }
1026
1027 $ui_comm delete 0.0 end
1028 - $ui_comm edit modified false
1028 $ui_comm edit reset
1029 + $ui_comm edit modified false
1030
1031 if {$single_commit} do_quit
1032
@@ -1966,7 +1966,7 @@ proc do_fsck_objects {} {
1966 set is_quitting 0
1967
1968 proc do_quit {} {
1969 - global gitdir ui_comm is_quitting repo_config
1969 + global gitdir ui_comm is_quitting repo_config commit_type
1970
1971 if {$is_quitting} return
1972 set is_quitting 1
@@ -1975,14 +1975,16 @@ proc do_quit {} {
1975 #
1976 set save [file join $gitdir GITGUI_MSG]
1977 set msg [string trim [$ui_comm get 0.0 end]]
1978 - if {[$ui_comm edit modified] && $msg ne {}} {
1978 + if {![string match amend* $commit_type]
1979 + && [$ui_comm edit modified]
1980 + && $msg ne {}} {
1981 catch {
1982 set fd [open $save w]
1983 puts $fd [string trim [$ui_comm get 0.0 end]]
1984 close $fd
1985 }
1984 - } elseif {$msg eq {} && [file exists $save]} {
1985 - file delete $save
1986 + } else {
1987 + catch {file delete $save}
1988 }
1989
1990 # -- Stash our current window geometry into this repository.