Jeff King [off-list ref] writes:
... I had one concern that
I was tracking down: is the author name encoding necessarily the same as
the commit text encoding?
The user is screwing himself already if that is the case and
uses -s to format-patch, isn't he?
On Wed, Oct 31, 2007 at 03:31:20PM -0700, Junio C Hamano wrote:
quoted
... I had one concern that
I was tracking down: is the author name encoding necessarily the same as
the commit text encoding?
The user is screwing himself already if that is the case and
uses -s to format-patch, isn't he?
Hrm, they probably _should_ be the same in the output. It's not clear to
me what encoding we assume the name comes in (utf-8, I guess). Looks
like we don't touch it at all when putting it in the signoff. I think we
should just be able to reencode when appending the signoff; patch is
below.
I'm sure there are other weird interactions lurking. For example, do we
correctly detect an existing signoff if we are storing in a non-utf8
encoding? I must admit to being a little ignorant to some of the
encoding magic of git, having a us-ascii name myself.
---
diff --git a/log-tree.c b/log-tree.c
index 3763ce9..906942d 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -3,6 +3,7 @@
#include "commit.h"
#include "log-tree.h"
#include "reflog-walk.h"
+#include "utf8.h"
struct decoration name_decoration = { "object names" };
@@ -111,7 +112,14 @@ static void append_signoff(struct strbuf *sb, const char *signoff)
strbuf_addch(sb, '\n');
strbuf_addstr(sb, signed_off_by);
- strbuf_add(sb, signoff, signoff_len);
+ if (git_log_output_encoding) {
+ char *encoded_name = reencode_string(signoff,
+ git_log_output_encoding, "utf-8");
+ strbuf_addstr(sb, encoded_name);
+ free(encoded_name);
+ }
+ else
+ strbuf_add(sb, signoff, signoff_len);
strbuf_addch(sb, '\n');
}