From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH 1/6] pretty: remove reencode_commit_message() Date: Wed, 17 Oct 2012 22:45:23 -0700 Message-ID: <1350539128-21577-2-git-send-email-gitster@pobox.com> References: <1350539128-21577-1-git-send-email-gitster@pobox.com> To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Oct 18 07:45:47 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TOivQ-0005GL-Sy for gcvg-git-2@plane.gmane.org; Thu, 18 Oct 2012 07:45:45 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754176Ab2JRFpe (ORCPT ); Thu, 18 Oct 2012 01:45:34 -0400 Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:59858 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754088Ab2JRFpd (ORCPT ); Thu, 18 Oct 2012 01:45:33 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 058D46D19 for ; Thu, 18 Oct 2012 01:45:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references; s=sasl; bh=RRXH Bw4J3jMmYFcUm82Dx/bLnOc=; b=pwUqz5wJ5bXsA9ptb7tSubadHlCWJJbuEpC7 vVrGl1u8GKKwFAVlsJtH9hee5D1TSLP8YA3THHJ6OzF+hZ4cEvwohFlNmBE9z/u+ SUWApbESIBZ6eFuXpbtrKYFbAH0k74l8qQ3mi+FWY+/m/nRG74xKycf+93qGWQpr Yq+H0rM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:in-reply-to:references; q=dns; s=sasl; b=GYr5lE 85CHqorWJSuLYmFy89XmiC6QjGTYQNZMwEBJW9VSiJ81VzlQJFL3Qod/jvc5nZdo qFu1BSZDAGPlA4ut9BFZMwYzNNLy+ehmibERR/1VQIIkqvoPjJR/NtWsnEDGdwz+ gdsyVs/UdNeiU64SRjPAu9njZlCcCX+38iJug= Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id E5C576D18 for ; Thu, 18 Oct 2012 01:45:32 -0400 (EDT) Received: from pobox.com (unknown [98.234.214.94]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by b-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 4B0456D15 for ; Thu, 18 Oct 2012 01:45:32 -0400 (EDT) X-Mailer: git-send-email 1.8.0.rc3.112.gdb88a5e In-Reply-To: <1350539128-21577-1-git-send-email-gitster@pobox.com> X-Pobox-Relay-ID: 07DFA404-18E7-11E2-AFF8-BB652E706CDE-77302942!b-pb-sasl-quonix.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This function has only two callsites, and is a thin wrapper whose usefulness is dubious. When the caller needs to learn the log output encoding, it should be able to do so by directly calling get_log_output_encoding() and calling the underlying logmsg_reencode() with it. Signed-off-by: Junio C Hamano --- builtin/blame.c | 5 +++-- commit.h | 2 -- pretty.c | 13 ++----------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index c27ef21..cfae569 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1425,7 +1425,7 @@ static void get_commit_info(struct commit *commit, int detailed) { int len; - const char *subject; + const char *subject, *encoding; char *reencoded, *message; static char author_name[1024]; static char author_mail[1024]; @@ -1446,7 +1446,8 @@ static void get_commit_info(struct commit *commit, die("Cannot read commit %s", sha1_to_hex(commit->object.sha1)); } - reencoded = reencode_commit_message(commit, NULL); + encoding = get_log_output_encoding(); + reencoded = logmsg_reencode(commit, encoding); message = reencoded ? reencoded : commit->buffer; ret->author = author_name; ret->author_mail = author_mail; diff --git a/commit.h b/commit.h index 9f21313..a822af8 100644 --- a/commit.h +++ b/commit.h @@ -99,8 +99,6 @@ extern int has_non_ascii(const char *text); struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */ extern char *logmsg_reencode(const struct commit *commit, const char *output_encoding); -extern char *reencode_commit_message(const struct commit *commit, - const char **encoding_p); extern void get_commit_format(const char *arg, struct rev_info *); extern const char *format_subject(struct strbuf *sb, const char *msg, const char *line_separator); diff --git a/pretty.c b/pretty.c index 8b1ea9f..c311a68 100644 --- a/pretty.c +++ b/pretty.c @@ -1341,16 +1341,6 @@ void pp_remainder(const struct pretty_print_context *pp, } } -char *reencode_commit_message(const struct commit *commit, const char **encoding_p) -{ - const char *encoding; - - encoding = get_log_output_encoding(); - if (encoding_p) - *encoding_p = encoding; - return logmsg_reencode(commit, encoding); -} - void pretty_print_commit(const struct pretty_print_context *pp, const struct commit *commit, struct strbuf *sb) @@ -1367,7 +1357,8 @@ void pretty_print_commit(const struct pretty_print_context *pp, return; } - reencoded = reencode_commit_message(commit, &encoding); + encoding = get_log_output_encoding(); + reencoded = logmsg_reencode(commit, encoding); if (reencoded) { msg = reencoded; } -- 1.8.0.rc3.112.gdb88a5e