Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH 1/3] Introduce i18n.commitencoding.
Date: Sun, 27 Nov 2005 16:39:08 -0800	[thread overview]
Message-ID: <7vd5kl61xv.fsf@assigned-by-dhcp.cox.net> (raw)

This is to hold what the project-local rule as to the
charset/encoding for the commit log message is.  Lack of it
defaults to utf-8.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 * This is not needed to make the gitk patch I just sent out
   work, because git-repo-config can do its own thing without
   the C-level integration like this.

   That may or may not be a good thing, though.  I wished either
   'git-var i18n.commitencoding' or 'git-repo-config --get
   i18n.commitencoding' in a vanilla repository to emit the
   default "utf-8".  Johannes?

 cache.h       |    3 +++
 config.c      |    5 +++++
 environment.c |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

applies-to: 5596ac6f4661c80f823d93de7fa9aeec65ace1f1
4e72dcec89c7cda7022d4ec2dd686e77deb5376e
diff --git a/cache.h b/cache.h
index 61bf884..634b5aa 100644
--- a/cache.h
+++ b/cache.h
@@ -399,6 +399,9 @@ extern int check_repository_format_versi
 extern char git_default_email[MAX_GITNAME];
 extern char git_default_name[MAX_GITNAME];
 
+#define MAX_ENCODING_LENGTH 64
+extern char git_commit_encoding[MAX_ENCODING_LENGTH];
+
 /* Sane ctype - no locale, and works with signed chars */
 #undef isspace
 #undef isdigit
diff --git a/config.c b/config.c
index 0c43d76..152fa28 100644
--- a/config.c
+++ b/config.c
@@ -237,6 +237,11 @@ int git_default_config(const char *var, 
 		return 0;
 	}
 
+	if (!strcmp(var, "i18n.commitencoding")) {
+		strncpy(git_commit_encoding, value, sizeof(git_commit_encoding));
+		return 0;
+	}
+
 	/* Add other config variables here.. */
 	return 0;
 }
diff --git a/environment.c b/environment.c
index 3f19473..0886ad3 100644
--- a/environment.c
+++ b/environment.c
@@ -14,6 +14,7 @@ char git_default_name[MAX_GITNAME];
 int trust_executable_bit = 1;
 int only_use_symrefs = 0;
 int repository_format_version = 0;
+char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
 
 static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
 	*git_graft_file;
---
0.99.9.GIT

                 reply	other threads:[~2005-11-28  0:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vd5kl61xv.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox