* js/diff-ni:
Get rid of the dependency to GNU diff in the tests
diff --no-index: support /dev/null as filename
diff-ni: fix the diff with standard input
diff: support reading a file from stdin via "-"
static int populate_from_stdin(struct diff_filespec *s)
{
#define INCREMENT 1024
char *buf;
unsigned long size;
int got;
size = 0;
buf = NULL;
while (1) {
buf = xrealloc(buf, size + INCREMENT);
got = xread(0, buf + size, INCREMENT);
if (!got)
break; /* EOF */
if (got < 0)
return error("error while reading from stdin %s",
strerror(errno));
size += got;
}
s->should_munmap = 0;
s->data = buf;
s->size = size;
s->should_free = 1;
return 0;
}
/*
* While doing rename detection and pickaxe operation, we may need to
* grab the data for the blob (or file) for our own in-core comparison.
@ -1389,6 +1415,9 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
@@ -1389,6 +1415,9 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
@ -54,7 +54,7 @@ test_expect_success 'apply without --reject should fail' '
@@ -54,7 +54,7 @@ test_expect_success 'apply without --reject should fail' '
exit 1
fi
diff -u file1 saved.file1
git diff file1 saved.file1
'
test_expect_success 'apply without --reject should fail' '
@ -65,7 +65,7 @@ test_expect_success 'apply without --reject should fail' '
@@ -65,7 +65,7 @@ test_expect_success 'apply without --reject should fail' '
exit 1
fi
diff -u file1 saved.file1
git diff file1 saved.file1
'
test_expect_success 'apply with --reject should fail but update the file' '
@ -79,7 +79,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
@@ -79,7 +79,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
exit 1
fi
diff -u file1 expected &&
git diff file1 expected &&
cat file1.rej &&
@ -105,7 +105,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
@@ -105,7 +105,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
echo "file1 still exists?"
exit 1
}
diff -u file2 expected &&
git diff file2 expected &&
cat file2.rej &&
@ -132,7 +132,7 @@ test_expect_success 'the same test with --verbose' '
@@ -132,7 +132,7 @@ test_expect_success 'the same test with --verbose' '
echo "file1 still exists?"
exit 1
}
diff -u file2 expected &&
git diff file2 expected &&
cat file2.rej &&
@ -151,7 +151,7 @@ test_expect_success 'apply cleanly with --verbose' '
@@ -151,7 +151,7 @@ test_expect_success 'apply cleanly with --verbose' '