Add option to enable threading headers
Add a --thread option to enable generation of In-Reply-To and References headers, used to make the second and subsequent mails appear as replies to the first. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
d1566f7883
commit
cc35de8470
@ -9,7 +9,7 @@ git-format-patch - Prepare patches for e-mail submission
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach]
|
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread]
|
||||||
[-s | --signoff] [--diff-options] [--start-number <n>]
|
[-s | --signoff] [--diff-options] [--start-number <n>]
|
||||||
<since>[..<until>]
|
<since>[..<until>]
|
||||||
|
|
||||||
@ -35,6 +35,10 @@ they are created in the current working directory.
|
|||||||
If -n is specified, instead of "[PATCH] Subject", the first line
|
If -n is specified, instead of "[PATCH] Subject", the first line
|
||||||
is formatted as "[PATCH n/m] Subject".
|
is formatted as "[PATCH n/m] Subject".
|
||||||
|
|
||||||
|
If given --thread, git-format-patch will generate In-Reply-To and
|
||||||
|
References headers to make the second and subsequent patch mails appear
|
||||||
|
as replies to the first mail; this also generates a Message-Id header to
|
||||||
|
reference.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@ -63,6 +67,10 @@ OPTIONS
|
|||||||
--attach::
|
--attach::
|
||||||
Create attachments instead of inlining patches.
|
Create attachments instead of inlining patches.
|
||||||
|
|
||||||
|
--thread::
|
||||||
|
Add In-Reply-To and References headers to make the second and
|
||||||
|
subsequent mails appear as replies to the first. Also generates
|
||||||
|
the Message-Id header to reference.
|
||||||
|
|
||||||
CONFIGURATION
|
CONFIGURATION
|
||||||
-------------
|
-------------
|
||||||
|
@ -248,6 +248,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
|||||||
int start_number = -1;
|
int start_number = -1;
|
||||||
int keep_subject = 0;
|
int keep_subject = 0;
|
||||||
int ignore_if_in_upstream = 0;
|
int ignore_if_in_upstream = 0;
|
||||||
|
int thread = 0;
|
||||||
struct diff_options patch_id_opts;
|
struct diff_options patch_id_opts;
|
||||||
char *add_signoff = NULL;
|
char *add_signoff = NULL;
|
||||||
char message_id[1024];
|
char message_id[1024];
|
||||||
@ -317,6 +318,8 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
|||||||
rev.mime_boundary = argv[i] + 9;
|
rev.mime_boundary = argv[i] + 9;
|
||||||
else if (!strcmp(argv[i], "--ignore-if-in-upstream"))
|
else if (!strcmp(argv[i], "--ignore-if-in-upstream"))
|
||||||
ignore_if_in_upstream = 1;
|
ignore_if_in_upstream = 1;
|
||||||
|
else if (!strcmp(argv[i], "--thread"))
|
||||||
|
thread = 1;
|
||||||
else
|
else
|
||||||
argv[j++] = argv[i];
|
argv[j++] = argv[i];
|
||||||
}
|
}
|
||||||
@ -379,15 +382,17 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
|||||||
commit = list[nr];
|
commit = list[nr];
|
||||||
rev.nr = total - nr + (start_number - 1);
|
rev.nr = total - nr + (start_number - 1);
|
||||||
/* Make the second and subsequent mails replies to the first */
|
/* Make the second and subsequent mails replies to the first */
|
||||||
if (nr == (total - 2)) {
|
if (thread) {
|
||||||
strncpy(ref_message_id, message_id,
|
if (nr == (total - 2)) {
|
||||||
sizeof(ref_message_id));
|
strncpy(ref_message_id, message_id,
|
||||||
ref_message_id[sizeof(ref_message_id)-1] = '\0';
|
sizeof(ref_message_id));
|
||||||
rev.ref_message_id = ref_message_id;
|
ref_message_id[sizeof(ref_message_id)-1]='\0';
|
||||||
|
rev.ref_message_id = ref_message_id;
|
||||||
|
}
|
||||||
|
gen_message_id(message_id, sizeof(message_id),
|
||||||
|
sha1_to_hex(commit->object.sha1));
|
||||||
|
rev.message_id = message_id;
|
||||||
}
|
}
|
||||||
gen_message_id(message_id, sizeof(message_id),
|
|
||||||
sha1_to_hex(commit->object.sha1));
|
|
||||||
rev.message_id = message_id;
|
|
||||||
if (!use_stdout)
|
if (!use_stdout)
|
||||||
reopen_stdout(commit, rev.nr, keep_subject);
|
reopen_stdout(commit, rev.nr, keep_subject);
|
||||||
shown = log_tree_commit(&rev, commit);
|
shown = log_tree_commit(&rev, commit);
|
||||||
|
Reference in New Issue
Block a user