Code

Merge git://repo.or.cz/git-gui
[git.git] / git-gui / lib / commit.tcl
index 2977315624fc5deeecff275d8dc8b3f2e3210a70..9cc84105952d02f0171be0e23f0a82373bae0545 100644 (file)
@@ -27,9 +27,8 @@ You are currently in the middle of a merge that has not been fully completed.  Y
        if {[catch {
                        set fd [git_read cat-file commit $curHEAD]
                        fconfigure $fd -encoding binary -translation lf
-                       if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
-                               set enc utf-8
-                       }
+                       # By default commits are assumed to be in utf-8
+                       set enc utf-8
                        while {[gets $fd line] > 0} {
                                if {[string match {parent *} $line]} {
                                        lappend parents [string range $line 7 end]
@@ -168,7 +167,7 @@ File %s cannot be committed by this program.
                }
                }
        }
-       if {!$files_ready && ![string match *merge $curType]} {
+       if {!$files_ready && ![string match *merge $curType] && ![is_enabled nocommit]} {
                info_popup [mc "No changes to commit.
 
 You must stage at least 1 file before you can commit.
@@ -177,6 +176,8 @@ You must stage at least 1 file before you can commit.
                return
        }
 
+       if {[is_enabled nocommitmsg]} { do_quit 0 }
+
        # -- A message is required.
        #
        set msg [string trim [$ui_comm get 1.0 end]]
@@ -206,12 +207,14 @@ A good commit message has the following format:
        if {$use_enc ne {}} {
                fconfigure $msg_wt -encoding $use_enc
        } else {
-               puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
+               error_popup [mc "warning: Tcl does not support encoding '%s'." $enc]
                fconfigure $msg_wt -encoding utf-8
        }
        puts $msg_wt $msg
        close $msg_wt
 
+       if {[is_enabled nocommit]} { do_quit 0 }
+
        # -- Run the pre-commit hook.
        #
        set fd_ph [githook_read pre-commit]
@@ -410,7 +413,7 @@ A rescan will be automatically started now.
                set ::GITGUI_BCK_exists 0
        }
 
-       if {[is_enabled singlecommit]} do_quit
+       if {[is_enabled singlecommit]} { do_quit 0 }
 
        # -- Update in memory status
        #