summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorNazri Ramliy <ayiehere@gmail.com>2009-02-12 21:36:14 +0800
committerJunio C Hamano <gitster@pobox.com>2009-02-12 12:31:52 -0800
commita8344abe0f70f9fc629ee055d73ffa65fbc58311 (patch)
treeb1b33c20811a2b62866530dea12b910f47d3c465 /diff.c
parent30aa4fb15fa408596dea59cdc9f00c94eeaa69f1 (diff)
downloadgit-a8344abe0f70f9fc629ee055d73ffa65fbc58311.tar.gz
Bugfix: GIT_EXTERNAL_DIFF with more than one changed files
When there is more than one file that are changed, running git diff with GIT_EXTERNAL_DIFF incorrectly diagnoses an programming error and dies. The check introduced in 479b0ae (diff: refactor tempfile cleanup handling, 2009-01-22) to detect a temporary file slot that forgot to remove its temporary file was inconsistent with the way the codepath to remove the temporary to mark the slot that it is done with it. This patch fixes this problem and adds a test case for it. Signed-off-by: Nazri Ramliy <ayiehere@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index a5a540fd38..be3859e0a7 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)