aboutsummaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJosh Triplett <josht@us.ibm.com>2006-07-14 17:49:04 -0700
committerJunio C Hamano <junkio@cox.net>2006-07-14 20:41:37 -0700
commitcc35de8470541e389b7d2bdda4c901574720fa81 (patch)
tree7d79f1a5716f5ba170f2dea234b765f8bc7c976e /builtin-log.c
parentd1566f7883f727f38bf442af3fdb69d36e6fcea2 (diff)
downloadgit-cc35de8470541e389b7d2bdda4c901574720fa81.tar.gz
git-cc35de8470541e389b7d2bdda4c901574720fa81.tar.xz
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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 1f1074cec..646676805 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -248,6 +248,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
int start_number = -1;
int keep_subject = 0;
int ignore_if_in_upstream = 0;
+ int thread = 0;
struct diff_options patch_id_opts;
char *add_signoff = NULL;
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;
else if (!strcmp(argv[i], "--ignore-if-in-upstream"))
ignore_if_in_upstream = 1;
+ else if (!strcmp(argv[i], "--thread"))
+ thread = 1;
else
argv[j++] = argv[i];
}
@@ -379,15 +382,17 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
commit = list[nr];
rev.nr = total - nr + (start_number - 1);
/* Make the second and subsequent mails replies to the first */
- if (nr == (total - 2)) {
- strncpy(ref_message_id, message_id,
- sizeof(ref_message_id));
- ref_message_id[sizeof(ref_message_id)-1] = '\0';
- rev.ref_message_id = ref_message_id;
+ if (thread) {
+ if (nr == (total - 2)) {
+ strncpy(ref_message_id, message_id,
+ sizeof(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)
reopen_stdout(commit, rev.nr, keep_subject);
shown = log_tree_commit(&rev, commit);