aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run-command.c3
-rwxr-xr-xt/t5601-clone.sh6
2 files changed, 9 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index a3b28a64d..6af83c526 100644
--- a/run-command.c
+++ b/run-command.c
@@ -304,6 +304,9 @@ int start_async(struct async *async)
async->out = pipe_out[0];
#ifndef __MINGW32__
+ /* Flush stdio before fork() to avoid cloning buffers */
+ fflush(NULL);
+
async->pid = fork();
if (async->pid < 0) {
error("fork (async) failed: %s", strerror(errno));
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 57173b4c5..a13b6f9d3 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -31,6 +31,12 @@ test_expect_success 'clone with excess parameters (2)' '
'
+test_expect_success 'output from clone' '
+ rm -fr dst &&
+ git clone -n "file://$(pwd)/src" dst >output &&
+ test $(grep Initialized output | wc -l) = 1
+'
+
test_expect_success 'clone does not keep pack' '
rm -fr dst &&