Re: [PATCH 1/1] Add --first-parent support to interactive rebase.

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/1] Add --first-parent support to interactive rebase.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:45

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?

Re: [PATCH 1/1] Add --first-parent support to interactive rebase.

From: Jeff King <hidden>
Date: 2016-06-15 22:43:45

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');
 }
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help