diff options
author | Junio C Hamano <junkio@cox.net> | 2006-12-28 19:03:02 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-28 19:03:02 -0800 |
commit | eff73751bb94b0241fd2204effb8680fe9973cbf (patch) | |
tree | 5fe6f0f55988d64a7b8b841c62b1c996a3fda5bf /builtin-commit-tree.c | |
parent | 013672bc589da395fcba9bf62d699e70f3764689 (diff) | |
parent | 7255ff0446217ad723dad6088504a18f6afb15db (diff) | |
download | git-eff73751bb94b0241fd2204effb8680fe9973cbf.tar.gz |
Merge branch 'jc/utf8'
* jc/utf8:
t3900: test conversion to non UTF-8 as well
Rename t3900 test vector file
UTF-8: introduce i18n.logoutputencoding.
Teach log family --encoding
i18n.logToUTF8: convert commit log message to UTF-8
Move encoding conversion routine out of mailinfo to utf8.c
Conflicts:
commit.c
Diffstat (limited to 'builtin-commit-tree.c')
-rw-r--r-- | builtin-commit-tree.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c index f641787988..146aaffd28 100644 --- a/builtin-commit-tree.c +++ b/builtin-commit-tree.c @@ -92,6 +92,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) char comment[1000]; char *buffer; unsigned int size; + int encoding_is_utf8; setup_ident(); git_config(git_default_config); @@ -117,6 +118,10 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) parents++; } + /* Not having i18n.commitencoding is the same as having utf-8 */ + encoding_is_utf8 = (!git_commit_encoding || + !strcmp(git_commit_encoding, "utf-8")); + init_buffer(&buffer, &size); add_buffer(&buffer, &size, "tree %s\n", sha1_to_hex(tree_sha1)); @@ -130,7 +135,11 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) /* Person/date information */ add_buffer(&buffer, &size, "author %s\n", git_author_info(1)); - add_buffer(&buffer, &size, "committer %s\n\n", git_committer_info(1)); + add_buffer(&buffer, &size, "committer %s\n", git_committer_info(1)); + if (!encoding_is_utf8) + add_buffer(&buffer, &size, + "encoding %s\n", git_commit_encoding); + add_buffer(&buffer, &size, "\n"); /* And add the comment */ while (fgets(comment, sizeof(comment), stdin) != NULL) @@ -138,7 +147,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) /* And check the encoding */ buffer[size] = '\0'; - if (!strcmp(git_commit_encoding, "utf-8") && !is_utf8(buffer)) + if (encoding_is_utf8 && !is_utf8(buffer)) fprintf(stderr, commit_utf8_warn); if (!write_sha1_file(buffer, size, commit_type, commit_sha1)) { |