diff options
| author | Kristoffer Haugsbakk <code@khaugsbakk.name> | 2025-09-25 19:07:34 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-09-25 11:34:11 -0700 |
| commit | 71fd6c695cd9fc9cc0a829d1579c7584c2ad9e18 (patch) | |
| tree | e4e2022ac254b5c54495e76364709869d669413b /range-diff.c | |
| parent | ca2559c1d630eb4f04cdee2328aaf1c768907a9e (diff) | |
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>
Diffstat (limited to 'range-diff.c')
| -rw-r--r-- | range-diff.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/range-diff.c b/range-diff.c index ca449a0769..57edff40a8 100644 --- a/range-diff.c +++ b/range-diff.c @@ -39,7 +39,7 @@ struct patch_util { * as struct object_id (will need to be free()d). */ static int read_patches(const char *range, struct string_list *list, - const struct strvec *other_arg, + const struct strvec *log_arg, unsigned int include_merges) { struct child_process cp = CHILD_PROCESS_INIT; @@ -69,8 +69,8 @@ static int read_patches(const char *range, struct string_list *list, if (!include_merges) strvec_push(&cp.args, "--no-merges"); strvec_push(&cp.args, range); - if (other_arg) - strvec_pushv(&cp.args, other_arg->v); + if (log_arg) + strvec_pushv(&cp.args, log_arg->v); cp.out = -1; cp.no_stdin = 1; cp.git_cmd = 1; @@ -594,9 +594,9 @@ int show_range_diff(const char *range1, const char *range2, if (range_diff_opts->left_only && range_diff_opts->right_only) res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only"); - if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg, include_merges)) + if (!res && read_patches(range1, &branch1, range_diff_opts->log_arg, include_merges)) res = error(_("could not parse log for '%s'"), range1); - if (!res && read_patches(range2, &branch2, range_diff_opts->other_arg, include_merges)) + if (!res && read_patches(range2, &branch2, range_diff_opts->log_arg, include_merges)) res = error(_("could not parse log for '%s'"), range2); if (!res) { |
