diff options
author | Junio C Hamano <junkio@cox.net> | 2007-02-28 14:18:57 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-28 14:18:57 -0800 |
commit | 1db8b60b2a6ef0cc0f7cc7d0783b7cda2ce894ca (patch) | |
tree | 1d5433fb0c0a74e1478962daaba65b2ced03a43e /contrib | |
parent | d0d8e14d1bad5f5ad3fb27a6ac819ff4e7006f03 (diff) | |
parent | a1367d1219439fef8e82e546cbe742910231e5b3 (diff) | |
download | git-1db8b60b2a6ef0cc0f7cc7d0783b7cda2ce894ca.tar.gz |
Merge branch 'maint'
* maint:
Start preparing Release Notes for 1.5.0.3
Documentation: git-remote add [-t <branch>] [-m <branch>] [-f] name url
Include config.mak in doc/Makefile
git.el: Set the default commit coding system from the repository config.
git-archimport: support empty summaries, put summary on a single line.
http-push.c::lock_remote(): validate all remote refs.
git-cvsexportcommit: don't cleanup .msg if not yet committed to cvs.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/emacs/git.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index 24629eb3e2..13d198229b 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -75,10 +75,11 @@ then to `add-log-mailing-address' and then to `user-mail-address'." :type '(choice (const :tag "Default" nil) (string :tag "Email"))) -(defcustom git-commits-coding-system 'utf-8 +(defcustom git-commits-coding-system nil "Default coding system for the log message of git commits." :group 'git - :type 'coding-system) + :type '(choice (const :tag "From repository config" nil) + (coding-system))) (defcustom git-append-signed-off-by nil "Whether to append a Signed-off-by line to the commit message before editing." @@ -236,6 +237,15 @@ and returns the process output as a string." (and (fboundp 'user-mail-address) (user-mail-address)) (and (boundp 'user-mail-address) user-mail-address))) +(defun git-get-commits-coding-system () + "Return the coding system to use for commits." + (let ((repo-config (git-config "i18n.commitencoding"))) + (or git-commits-coding-system + (and repo-config + (fboundp 'locale-charset-to-coding-system) + (locale-charset-to-coding-system repo-config)) + 'utf-8))) + (defun git-escape-file-name (name) "Escape a file name if necessary." (if (string-match "[\n\t\"\\]" name) @@ -327,7 +337,7 @@ and returns the process output as a string." "Call git-commit-tree with buffer as input and return the resulting commit SHA1." (let ((author-name (git-get-committer-name)) (author-email (git-get-committer-email)) - author-date log-start log-end args) + author-date log-start log-end args coding-system-for-write) (when head (push "-p" args) (push head args)) @@ -350,12 +360,12 @@ and returns the process output as a string." (push "-p" args) (push (match-string 1) args)))) (setq log-start (point-min))) - (setq log-end (point-max))) + (setq log-end (point-max)) + (setq coding-system-for-write buffer-file-coding-system)) (git-get-string-sha1 (with-output-to-string (with-current-buffer standard-output - (let ((coding-system-for-write git-commits-coding-system) - (env `(("GIT_AUTHOR_NAME" . ,author-name) + (let ((env `(("GIT_AUTHOR_NAME" . ,author-name) ("GIT_AUTHOR_EMAIL" . ,author-email) ("GIT_COMMITTER_NAME" . ,(git-get-committer-name)) ("GIT_COMMITTER_EMAIL" . ,(git-get-committer-email))))) @@ -888,6 +898,7 @@ and returns the process output as a string." (let ((buffer (get-buffer-create "*git-commit*")) (merge-heads (git-get-merge-heads)) (dir default-directory) + (coding-system (git-get-commits-coding-system)) (sign-off git-append-signed-off-by)) (with-current-buffer buffer (when (eq 0 (buffer-size)) @@ -912,6 +923,7 @@ and returns the process output as a string." (git-get-committer-name) (git-get-committer-email))))))) (log-edit #'git-do-commit nil #'git-log-edit-files buffer) (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords)) + (setq buffer-file-coding-system coding-system) (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))) (defun git-find-file () |