summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff.c8
-rwxr-xr-xt/t4020-diff-external.sh8
2 files changed, 12 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index a5a540f..be3859e 100644
--- a/diff.c
+++ b/diff.c
@@ -184,11 +184,11 @@ static int remove_tempfile_installed;
static void remove_tempfile(void)
{
int i;
- for (i = 0; i < ARRAY_SIZE(diff_temp); i++)
- if (diff_temp[i].name == diff_temp[i].tmp_path) {
+ for (i = 0; i < ARRAY_SIZE(diff_temp); i++) {
+ if (diff_temp[i].name == diff_temp[i].tmp_path)
unlink(diff_temp[i].name);
- diff_temp[i].name = NULL;
- }
+ diff_temp[i].name = NULL;
+ }
}
static void remove_tempfile_on_signal(int signo)
diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh
index caea292..281680d 100755
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
@@ -128,4 +128,12 @@ test_expect_success 'force diff with "diff"' '
test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
'
+test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' '
+ echo anotherfile > file2 &&
+ git add file2 &&
+ git commit -m "added 2nd file" &&
+ echo modified >file2 &&
+ GIT_EXTERNAL_DIFF=echo git diff
+'
+
test_done