range-diff: rename other_arg to log_arg

Rename `other_arg` to `log_arg` in `range_diff_options` and related places. “Other argument” comes from bd361918 (range-diff: pass through --notes to `git log`, 2019-11-20) which introduced Git notes handling to git-range-diff(1) by passing that option on to git-log(1). And that kind of name might be fine in a local context. However, it was initially spread among multiple files, and is now[1] part of the `range_diff_options` struct. It is, prima facie, difficult to guess what “other” means, especially when just looking at the struct. But with a little reading we find out that it is used for `--[no-]notes` and `--diff-merges`, which are both passed on to git-log(1). We should just rename it to reflect this role; `log_arg` suggests, along with the `strvec` type, that it is used to pass extra arguments to git-log(1). † 1: since f1ce6c19 (range-diff: combine all options in a single data structure, 2021-02-05) Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kristoffer Haugsbakk committed Sep 25, 2025 at 19:07 UTC 71fd6c695cd9fc9cc0a829d1579c7584c2ad9e18
4 files changed +18 -18
builtin/log.c
+4 -4
@@ -1400,13 +1400,13 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
1400 * can be added later if deemed desirable.
1401 */
1402 struct diff_options opts;
1403 - struct strvec other_arg = STRVEC_INIT;
1403 + struct strvec log_arg = STRVEC_INIT;
1404 struct range_diff_options range_diff_opts = {
1405 .creation_factor = rev->creation_factor,
1406 .dual_color = 1,
1407 .max_memory = RANGE_DIFF_MAX_MEMORY_DEFAULT,
1408 .diffopt = &opts,
1409 - .other_arg = &other_arg
1409 + .log_arg = &log_arg
1410 };
1411
1412 repo_diff_setup(the_repository, &opts);
@@ -1414,9 +1414,9 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
1414 opts.use_color = rev->diffopt.use_color;
1415 diff_setup_done(&opts);
1416 fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title);
1417 - get_notes_args(&other_arg, rev);
1417 + get_notes_args(&log_arg, rev);
1418 show_range_diff(rev->rdiff1, rev->rdiff2, &range_diff_opts);
1419 - strvec_clear(&other_arg);
1419 + strvec_clear(&log_arg);
1420 }
1421 }
1422
builtin/range-diff.c
+8 -8
@@ -37,13 +37,13 @@ int cmd_range_diff(int argc,
37 struct repository *repo UNUSED)
38 {
39 struct diff_options diffopt = { NULL };
40 - struct strvec other_arg = STRVEC_INIT;
40 + struct strvec log_arg = STRVEC_INIT;
41 struct strvec diff_merges_arg = STRVEC_INIT;
42 struct range_diff_options range_diff_opts = {
43 .creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT,
44 .max_memory = RANGE_DIFF_MAX_MEMORY_DEFAULT,
45 .diffopt = &diffopt,
46 - .other_arg = &other_arg
46 + .log_arg = &log_arg
47 };
48 int simple_color = -1, left_only = 0, right_only = 0;
49 struct option range_diff_options[] = {
@@ -52,7 +52,7 @@ int cmd_range_diff(int argc,
52 N_("percentage by which creation is weighted")),
53 OPT_BOOL(0, "no-dual-color", &simple_color,
54 N_("use simple diff colors")),
55 - OPT_PASSTHRU_ARGV(0, "notes", &other_arg,
55 + OPT_PASSTHRU_ARGV(0, "notes", &log_arg,
56 N_("notes"), N_("passed to 'git log'"),
57 PARSE_OPT_OPTARG),
58 OPT_PASSTHRU_ARGV(0, "diff-merges", &diff_merges_arg,
@@ -92,7 +92,7 @@ int cmd_range_diff(int argc,
92 /* If `--diff-merges` was specified, imply `--merges` */
93 if (diff_merges_arg.nr) {
94 range_diff_opts.include_merges = 1;
95 - strvec_pushv(&other_arg, diff_merges_arg.v);
95 + strvec_pushv(&log_arg, diff_merges_arg.v);
96 }
97
98 for (i = 0; i < argc; i++)
@@ -124,7 +124,7 @@ int cmd_range_diff(int argc,
124 strbuf_addf(&range1, "%s..%s", argv[0], argv[1]);
125 strbuf_addf(&range2, "%s..%s", argv[0], argv[2]);
126
127 - strvec_pushv(&other_arg, argv +
127 + strvec_pushv(&log_arg, argv +
128 (dash_dash < 0 ? 3 : dash_dash));
129 } else if (dash_dash == 2 ||
130 (dash_dash < 0 && argc > 1 &&
@@ -144,7 +144,7 @@ int cmd_range_diff(int argc,
144 strbuf_addstr(&range1, argv[0]);
145 strbuf_addstr(&range2, argv[1]);
146
147 - strvec_pushv(&other_arg, argv +
147 + strvec_pushv(&log_arg, argv +
148 (dash_dash < 0 ? 2 : dash_dash));
149 } else if (dash_dash == 1 ||
150 (dash_dash < 0 && argc > 0 &&
@@ -175,7 +175,7 @@ int cmd_range_diff(int argc,
175 strbuf_addf(&range1, "%s..%.*s", b, a_len, a);
176 strbuf_addf(&range2, "%.*s..%s", a_len, a, b);
177
178 - strvec_pushv(&other_arg, argv +
178 + strvec_pushv(&log_arg, argv +
179 (dash_dash < 0 ? 1 : dash_dash));
180 } else
181 usage_msg_opt(_("need two commit ranges"),
@@ -187,7 +187,7 @@ int cmd_range_diff(int argc,
187 range_diff_opts.right_only = right_only;
188 res = show_range_diff(range1.buf, range2.buf, &range_diff_opts);
189
190 - strvec_clear(&other_arg);
190 + strvec_clear(&log_arg);
191 strvec_clear(&diff_merges_arg);
192 strbuf_release(&range1);
193 strbuf_release(&range2);
range-diff.c
+5 -5
@@ -39,7 +39,7 @@ struct patch_util {
39 * as struct object_id (will need to be free()d).
40 */
41 static int read_patches(const char *range, struct string_list *list,
42 - const struct strvec *other_arg,
42 + const struct strvec *log_arg,
43 unsigned int include_merges)
44 {
45 struct child_process cp = CHILD_PROCESS_INIT;
@@ -69,8 +69,8 @@ static int read_patches(const char *range, struct string_list *list,
69 if (!include_merges)
70 strvec_push(&cp.args, "--no-merges");
71 strvec_push(&cp.args, range);
72 - if (other_arg)
73 - strvec_pushv(&cp.args, other_arg->v);
72 + if (log_arg)
73 + strvec_pushv(&cp.args, log_arg->v);
74 cp.out = -1;
75 cp.no_stdin = 1;
76 cp.git_cmd = 1;
@@ -594,9 +594,9 @@ int show_range_diff(const char *range1, const char *range2,
594 if (range_diff_opts->left_only && range_diff_opts->right_only)
595 res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only");
596
597 - if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg, include_merges))
597 + if (!res && read_patches(range1, &branch1, range_diff_opts->log_arg, include_merges))
598 res = error(_("could not parse log for '%s'"), range1);
599 - if (!res && read_patches(range2, &branch2, range_diff_opts->other_arg, include_merges))
599 + if (!res && read_patches(range2, &branch2, range_diff_opts->log_arg, include_merges))
600 res = error(_("could not parse log for '%s'"), range2);
601
602 if (!res) {
range-diff.h
+1 -1
@@ -23,7 +23,7 @@ struct range_diff_options {
23 unsigned include_merges:1;
24 size_t max_memory;
25 const struct diff_options *diffopt; /* may be NULL */
26 - const struct strvec *other_arg; /* may be NULL */
26 + const struct strvec *log_arg; /* may be NULL */
27 };
28
29 /*