format-patch: show base info before email signature
Any text below the "-- " for the email signature gets treated as part of the signature, and many mail clients will trim it from the quoted text for a reply. Move it above the signature, so people can reply to it more easily. Similarly, when producing the patch as a MIME attachment, the original code placed the base info after the attached part, which would be discarded. Move the base info to the end of the part, still inside the part boundary. Add tests for the exact format of the email signature, and add tests to ensure that the base info appears before the email signature when producing a plain-text output, and that it appears before the part boundary when producing a MIME attachment. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
6ebdac1bab
commit
480871e09e
@ -1042,7 +1042,6 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
||||
diff_flush(&opts);
|
||||
|
||||
fprintf(rev->diffopt.file, "\n");
|
||||
print_signature(rev->diffopt.file);
|
||||
}
|
||||
|
||||
static const char *clean_message_id(const char *msg_id)
|
||||
@ -1361,7 +1360,7 @@ static void print_bases(struct base_tree_info *bases, FILE *file)
|
||||
return;
|
||||
|
||||
/* Show the base commit */
|
||||
fprintf(file, "base-commit: %s\n", oid_to_hex(&bases->base_commit));
|
||||
fprintf(file, "\nbase-commit: %s\n", oid_to_hex(&bases->base_commit));
|
||||
|
||||
/* Show the prerequisite patches */
|
||||
for (i = bases->nr_patch_id - 1; i >= 0; i--)
|
||||
@ -1720,6 +1719,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
make_cover_letter(&rev, use_stdout,
|
||||
origin, nr, list, branch_name, quiet);
|
||||
print_bases(&bases, rev.diffopt.file);
|
||||
print_signature(rev.diffopt.file);
|
||||
total++;
|
||||
start_number--;
|
||||
}
|
||||
@ -1779,13 +1779,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
if (!use_stdout)
|
||||
rev.shown_one = 0;
|
||||
if (shown) {
|
||||
print_bases(&bases, rev.diffopt.file);
|
||||
if (rev.mime_boundary)
|
||||
fprintf(rev.diffopt.file, "\n--%s%s--\n\n\n",
|
||||
mime_boundary_leader,
|
||||
rev.mime_boundary);
|
||||
else
|
||||
print_signature(rev.diffopt.file);
|
||||
print_bases(&bases, rev.diffopt.file);
|
||||
}
|
||||
if (!use_stdout)
|
||||
fclose(rev.diffopt.file);
|
||||
|
||||
Reference in New Issue
Block a user