diff: clean up external-diff argv setup
Since the previous commit, setting up the tempfile for an external diff uses df->path from the diff_filespec, rather than the logical name. This means add_external_diff_name() does not need to take a "name" parameter at all, and we can drop it. And that in turn lets us simplify the conditional for handling renames (when the "other" name is non-NULL). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 6, 2023 at 06:04 UTC
de8f14e1c01451e751da80fb6309bf4a371b5b2b
1 file changed
+3
-6
diff.c
+3
-6
@@ -4278,7 +4278,6 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
4278
4279
static void add_external_diff_name(struct repository *r,
4280
struct strvec *argv,
4281
- const char *name,
4281
struct diff_filespec *df)
4282
{
4283
struct diff_tempfile *temp = prepare_temp_file(r, df->path, df);
@@ -4308,11 +4307,9 @@ static void run_external_diff(const char *pgm,
4307
strvec_push(&cmd.args, name);
4308
4309
if (one && two) {
4311
- add_external_diff_name(o->repo, &cmd.args, name, one);
4312
- if (!other)
4313
- add_external_diff_name(o->repo, &cmd.args, name, two);
4314
- else {
4315
- add_external_diff_name(o->repo, &cmd.args, other, two);
4310
+ add_external_diff_name(o->repo, &cmd.args, one);
4311
+ add_external_diff_name(o->repo, &cmd.args, two);
4312
+ if (other) {
4313
strvec_push(&cmd.args, other);
4314
strvec_push(&cmd.args, xfrm_msg);
4315
}