summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 30aa4fb)
raw | patch | inline | side by side (parent: 30aa4fb)
author | Nazri Ramliy <ayiehere@gmail.com> | |
Thu, 12 Feb 2009 13:36:14 +0000 (21:36 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 12 Feb 2009 20:31:52 +0000 (12:31 -0800) |
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>
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>
diff.c | patch | blob | history | |
t/t4020-diff-external.sh | patch | blob | history |
index a5a540fd381495d2a75527b0f4fbe23ad668708f..be3859e0a7b48ddd79f993866513d204cd83575f 100644 (file)
--- a/diff.c
+++ b/diff.c
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)
index caea292f15437f50fd324496ff511971cc9d1d0c..281680d95afacb291d56d9d7f23efed1f3169e93 100755 (executable)
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
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