38
* as struct object_id (will need to be free()d).
39
*/
40
static int read_patches(const char *range, struct string_list *list,
41
- const struct strvec *other_arg)
41
+ const struct strvec *other_arg,
42
+ unsigned int include_merges)
43
{
44
struct child_process cp = CHILD_PROCESS_INIT;
45
struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT;
50
size_t size;
51
int ret = -1;
52
52
- strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
53
+ strvec_pushl(&cp.args, "log", "--no-color", "-p",
54
"--reverse", "--date-order", "--decorate=no",
55
"--no-prefix", "--submodule=short",
56
/*
65
"--pretty=medium",
66
"--show-notes-by-default",
67
NULL);
68
+ if (!include_merges)
69
+ strvec_push(&cp.args, "--no-merges");
70
strvec_push(&cp.args, range);
71
if (other_arg)
72
strvec_pushv(&cp.args, other_arg->v);
99
}
100
101
if (skip_prefix(line, "commit ", &p)) {
102
+ char *q;
103
if (util) {
104
string_list_append(list, buf.buf)->util = util;
105
strbuf_reset(&buf);
106
}
107
CALLOC_ARRAY(util, 1);
108
+ if (include_merges && (q = strstr(p, " (from ")))
109
+ *q = '\0';
110
if (repo_get_oid(the_repository, p, &util->oid)) {
111
error(_("could not parse commit '%s'"), p);
112
FREE_AND_NULL(util);
577
578
struct string_list branch1 = STRING_LIST_INIT_DUP;
579
struct string_list branch2 = STRING_LIST_INIT_DUP;
580
+ unsigned int include_merges = range_diff_opts->include_merges;
581
582
if (range_diff_opts->left_only && range_diff_opts->right_only)
583
res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only");
584
578
- if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg))
585
+ if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg, include_merges))
586
res = error(_("could not parse log for '%s'"), range1);
580
- if (!res && read_patches(range2, &branch2, range_diff_opts->other_arg))
587
+ if (!res && read_patches(range2, &branch2, range_diff_opts->other_arg, include_merges))
588
res = error(_("could not parse log for '%s'"), range2);
589
590
if (!res) {