summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a94f457)
raw | patch | inline | side by side (parent: a94f457)
author | Alexandre Julliard <julliard@winehq.org> | |
Wed, 28 Feb 2007 19:59:48 +0000 (20:59 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 28 Feb 2007 20:39:14 +0000 (12:39 -0800) |
If not otherwise specified, take the default coding system for commits
from the 'i18n.commitencoding' repository configuration value.
Also set the buffer-file-coding-system variable in the log buffer to
make the selected coding system visible on the modeline.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
from the 'i18n.commitencoding' repository configuration value.
Also set the buffer-file-coding-system variable in the log buffer to
make the selected coding system visible on the modeline.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/emacs/git.el | patch | blob | history |
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 24629eb3e211505728c77db820618021203241ae..13d198229bbdf4c56f15bfbe0528c6714106e9e3 100644 (file)
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
: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."
(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)
"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))
(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)))))
(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))
(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 ()