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>
This commit is contained in:
committed by
Junio C Hamano
parent
a0f83e7776
commit
de8f14e1c0
9
diff.c
9
diff.c
@ -4278,7 +4278,6 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
|
|||||||
|
|
||||||
static void add_external_diff_name(struct repository *r,
|
static void add_external_diff_name(struct repository *r,
|
||||||
struct strvec *argv,
|
struct strvec *argv,
|
||||||
const char *name,
|
|
||||||
struct diff_filespec *df)
|
struct diff_filespec *df)
|
||||||
{
|
{
|
||||||
struct diff_tempfile *temp = prepare_temp_file(r, df->path, df);
|
struct diff_tempfile *temp = prepare_temp_file(r, df->path, df);
|
||||||
@ -4308,11 +4307,9 @@ static void run_external_diff(const char *pgm,
|
|||||||
strvec_push(&cmd.args, name);
|
strvec_push(&cmd.args, name);
|
||||||
|
|
||||||
if (one && two) {
|
if (one && two) {
|
||||||
add_external_diff_name(o->repo, &cmd.args, name, one);
|
add_external_diff_name(o->repo, &cmd.args, one);
|
||||||
if (!other)
|
add_external_diff_name(o->repo, &cmd.args, two);
|
||||||
add_external_diff_name(o->repo, &cmd.args, name, two);
|
if (other) {
|
||||||
else {
|
|
||||||
add_external_diff_name(o->repo, &cmd.args, other, two);
|
|
||||||
strvec_push(&cmd.args, other);
|
strvec_push(&cmd.args, other);
|
||||||
strvec_push(&cmd.args, xfrm_msg);
|
strvec_push(&cmd.args, xfrm_msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user