460
extra_hdr[extra_hdr_nr++] = xstrndup(value, len);
461
}
462
463
+#define THREAD_SHALLOW 1
464
+#define THREAD_DEEP 2
465
+static int thread = 0;
466
+
467
static int git_format_config(const char *var, const char *value, void *cb)
468
{
469
if (!strcmp(var, "format.headers")) {
493
auto_number = auto_number && numbered;
494
return 0;
495
}
496
+ if (!strcmp(var, "format.thread")) {
497
+ if (value && !strcasecmp(value, "deep")) {
498
+ thread = THREAD_DEEP;
499
+ return 0;
500
+ }
501
+ if (value && !strcasecmp(value, "shallow")) {
502
+ thread = THREAD_SHALLOW;
503
+ return 0;
504
+ }
505
+ thread = git_config_bool(var, value) && THREAD_SHALLOW;
506
+ return 0;
507
+ }
508
509
return git_log_config(var, value, cb);
510
}
783
int numbered_files = 0; /* _just_ numbers */
784
int subject_prefix = 0;
785
int ignore_if_in_upstream = 0;
770
- int thread = 0;
786
int cover_letter = 0;
787
int boundary_count = 0;
788
int no_binary_diff = 0;
875
}
876
else if (!strcmp(argv[i], "--ignore-if-in-upstream"))
877
ignore_if_in_upstream = 1;
863
- else if (!strcmp(argv[i], "--thread"))
864
- thread = 1;
878
+ else if (!strcmp(argv[i], "--thread")
879
+ || !strcmp(argv[i], "--thread=shallow"))
880
+ thread = THREAD_SHALLOW;
881
+ else if (!strcmp(argv[i], "--thread=deep"))
882
+ thread = THREAD_DEEP;
883
+ else if (!strcmp(argv[i], "--no-thread"))
884
+ thread = 0;
885
else if (!prefixcmp(argv[i], "--in-reply-to="))
886
in_reply_to = argv[i] + 14;
887
else if (!strcmp(argv[i], "--in-reply-to")) {
1056
/* Have we already had a message ID? */
1057
if (rev.message_id) {
1058
/*
1059
+ * For deep threading: make every mail
1060
+ * a reply to the previous one, no
1061
+ * matter what other options are set.
1062
+ *
1063
+ * For shallow threading:
1064
+ *
1065
* Without --cover-letter and
1066
* --in-reply-to, make every mail a
1067
* reply to the one before.
1076
* letter is a reply to the
1077
* --in-reply-to, if specified.
1078
*/
1053
- if (rev.ref_message_ids->nr > 0
1079
+ if (thread == THREAD_SHALLOW
1080
+ && rev.ref_message_ids->nr > 0
1081
&& (!cover_letter || rev.nr > 1))
1082
free(rev.message_id);
1083
else