run_external_diff: hoist common bits out of conditional
Whether we have diff_filespecs to give to the diff command or not, we always are going to run the program and pass it the pathname. Let's pull that duplicated part out of the conditional to make it more obvious. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 19, 2014 at 15:20 UTC
0d4217d92e3043e23a8960519a51cc7a36ed8914
1 file changed
+3
-5
diff.c
+3
-5
@@ -2911,13 +2911,14 @@ static void run_external_diff(const char *pgm,
2911
struct argv_array env = ARGV_ARRAY_INIT;
2912
struct diff_queue_struct *q = &diff_queued_diff;
2913
2914
+ argv_array_push(&argv, pgm);
2915
+ argv_array_push(&argv, name);
2916
+
2917
if (one && two) {
2918
struct diff_tempfile *temp_one, *temp_two;
2919
const char *othername = (other ? other : name);
2920
temp_one = prepare_temp_file(name, one);
2921
temp_two = prepare_temp_file(othername, two);
2919
- argv_array_push(&argv, pgm);
2920
- argv_array_push(&argv, name);
2922
argv_array_push(&argv, temp_one->name);
2923
argv_array_push(&argv, temp_one->hex);
2924
argv_array_push(&argv, temp_one->mode);
@@ -2928,9 +2929,6 @@ static void run_external_diff(const char *pgm,
2929
argv_array_push(&argv, other);
2930
argv_array_push(&argv, xfrm_msg);
2931
}
2931
- } else {
2932
- argv_array_push(&argv, pgm);
2933
- argv_array_push(&argv, name);
2932
}
2933
2934
argv_array_pushf(&env, "GIT_DIFF_PATH_COUNTER=%d", ++o->diff_path_counter);