From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Dmitry Potapov" <dpotapov@gmail.com>,
"Karl Hasselström" <kha@treskal.com>,
"Björn Steinbrink" <B.Steinbrink@gmx.de>,
Johannes.Schindelin@gmx.de, git@vger.kernel.org
Subject: Re: [PATCH 1/1] Add --first-parent support to interactive rebase.
Date: Wed, 31 Oct 2007 14:53:47 -0700 [thread overview]
Message-ID: <7v8x5jgdck.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20071031180557.GA12211@coredump.intra.peff.net
Jeff King <peff@peff.net> writes:
> It is our old friend vger adding the iso-8859-1 header, I think, since
> no encoding was specified.
>
> I think the problem is that git-format-patch only decides whether to
> append a MIME header based on the commit message contents; it does not
> take the Signed-Off-By into account. This may also be the cause of the
> recent complaints from Matti Aarnio.
I agree. "Signed-off-by" as part of the existing commit message
should be fine, but with "format-patch -s" the code needs to be
careful.
The following is on top of 'master'. I haven't tested it. If it
works, great. If it doesn't, at least it should illustrate what
needs to be touched.
Ideally a fix to 'maint' is needed --- the pretty-print
infrastructure on the 'master' side has strbuf changes and the
patch may have conflicts at the textual level, but it should be
straightforward to adjust to it by anybody so inclined (hint,
hint).
---
builtin-branch.c | 2 +-
builtin-log.c | 2 +-
builtin-rev-list.c | 3 ++-
builtin-show-branch.c | 2 +-
commit.c | 5 ++---
commit.h | 4 +++-
log-tree.c | 15 ++++++++++++++-
7 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 3da8b55..3e020cc 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -276,7 +276,7 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
commit = lookup_commit(item->sha1);
if (commit && !parse_commit(commit)) {
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &subject, 0, NULL, NULL, 0);
+ &subject, 0, NULL, NULL, 0, 0);
sub = subject.buf;
}
printf("%c %s%-*s%s %s %s\n", c, branch_get_color(color),
diff --git a/builtin-log.c b/builtin-log.c
index e8b982d..8b2bf63 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -787,7 +787,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
struct strbuf buf;
strbuf_init(&buf, 0);
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &buf, 0, NULL, NULL, 0);
+ &buf, 0, NULL, NULL, 0, 0);
printf("%c %s %s\n", sign,
sha1_to_hex(commit->object.sha1), buf.buf);
strbuf_release(&buf);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 4439332..6970467 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -86,7 +86,8 @@ static void show_commit(struct commit *commit)
struct strbuf buf;
strbuf_init(&buf, 0);
pretty_print_commit(revs.commit_format, commit,
- &buf, revs.abbrev, NULL, NULL, revs.date_mode);
+ &buf, revs.abbrev, NULL, NULL,
+ revs.date_mode, 0);
if (buf.len)
printf("%s%c", buf.buf, hdr_termination);
strbuf_release(&buf);
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 07a0c23..6dc835d 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -266,7 +266,7 @@ static void show_one_commit(struct commit *commit, int no_name)
strbuf_init(&pretty, 0);
if (commit->object.parsed) {
pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &pretty, 0, NULL, NULL, 0);
+ &pretty, 0, NULL, NULL, 0, 0);
pretty_str = pretty.buf;
}
if (!prefixcmp(pretty_str, "[PATCH] "))
diff --git a/commit.c b/commit.c
index ac24266..8262f6a 100644
--- a/commit.c
+++ b/commit.c
@@ -479,7 +479,7 @@ static int get_one_line(const char *msg)
}
/* High bit set, or ISO-2022-INT */
-static int non_ascii(int ch)
+int non_ascii(int ch)
{
ch = (ch & 0xff);
return ((ch & 0x80) || (ch == 0x1b));
@@ -1046,12 +1046,11 @@ static void pp_remainder(enum cmit_fmt fmt,
void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
struct strbuf *sb, int abbrev,
const char *subject, const char *after_subject,
- enum date_mode dmode)
+ enum date_mode dmode, int plain_non_ascii)
{
unsigned long beginning_of_body;
int indent = 4;
const char *msg = commit->buffer;
- int plain_non_ascii = 0;
char *reencoded;
const char *encoding;
diff --git a/commit.h b/commit.h
index b779de8..678c62b 100644
--- a/commit.h
+++ b/commit.h
@@ -61,13 +61,15 @@ enum cmit_fmt {
CMIT_FMT_UNSPECIFIED,
};
+extern int non_ascii(int);
extern enum cmit_fmt get_commit_format(const char *arg);
extern void format_commit_message(const struct commit *commit,
const void *format, struct strbuf *sb);
extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,
struct strbuf *,
int abbrev, const char *subject,
- const char *after_subject, enum date_mode);
+ const char *after_subject, enum date_mode,
+ int non_ascii_present);
/** Removes the first commit from a list sorted by date, and adds all
* of its parents.
diff --git a/log-tree.c b/log-tree.c
index 3763ce9..a34beb0 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -125,6 +125,18 @@ static unsigned int digits_in_number(unsigned int number)
return result;
}
+static int has_non_ascii(const char *s)
+{
+ int ch;
+ if (!s)
+ return 0;
+ while ((ch = *s++) != '\0') {
+ if (non_ascii(ch))
+ return 1;
+ }
+ return 0;
+}
+
void show_log(struct rev_info *opt, const char *sep)
{
struct strbuf msgbuf;
@@ -273,7 +285,8 @@ void show_log(struct rev_info *opt, const char *sep)
*/
strbuf_init(&msgbuf, 0);
pretty_print_commit(opt->commit_format, commit, &msgbuf,
- abbrev, subject, extra_headers, opt->date_mode);
+ abbrev, subject, extra_headers, opt->date_mode,
+ has_non_ascii(opt->add_signoff));
if (opt->add_signoff)
append_signoff(&msgbuf, opt->add_signoff);
next prev parent reply other threads:[~2007-10-31 21:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 2:21 [PATCH 1/1] Add --first-parent support to interactive rebase Björn Steinbrink
2007-10-31 3:34 ` Johannes Schindelin
2007-10-31 4:17 ` Björn Steinbrink
2007-10-31 4:50 ` Johannes Schindelin
2007-10-31 8:24 ` Wincent Colaiuta
2007-10-31 5:05 ` Junio C Hamano
2007-10-31 5:53 ` Björn Steinbrink
2007-10-31 13:43 ` Dmitry Potapov
2007-10-31 14:00 ` Karl Hasselström
2007-10-31 14:36 ` Dmitry Potapov
2007-10-31 18:05 ` Jeff King
2007-10-31 19:50 ` Björn Steinbrink
2007-10-31 21:53 ` Junio C Hamano [this message]
2007-10-31 21:56 ` Jeff King
2007-10-31 22:31 ` Junio C Hamano
2007-11-01 3:23 ` Jeff King
2007-11-01 4:10 ` Junio C Hamano
2007-11-01 4:14 ` Jeff King
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=7v8x5jgdck.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=B.Steinbrink@gmx.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=dpotapov@gmail.com \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
--cc=peff@peff.net \
/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;
as well as URLs for NNTP newsgroup(s).