diff options
author | Pete Wyckoff <pw@padd.com> | 2012-04-22 16:30:58 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-24 14:54:24 -0700 |
commit | 7fb8e163bdfdc5ffb69b98f3f05ef0dbade4e677 (patch) | |
tree | fd59cfc42d64520337820b4485c744096db4d4fd /dir.c | |
parent | Merge branch 'maint-1.7.9' into maint (diff) | |
download | tgif-7fb8e163bdfdc5ffb69b98f3f05ef0dbade4e677.tar.xz |
git-remote-testgit: fix race when spawning fast-import
Test "pushing to local repo" in t5800-remote-helpers can hang
due to a race condition in git-remote-testgit. Fix it by
setting stdin to unbuffered.
On the writer side, "git push" invokes push_refs_with_export(),
which sends to stdout the command "export\n" and immediately
starts up "git fast-export". The latter writes its output stream
to the same stdout.
On the reader side, remote helper "git-remote-testgit" reads from
stdin to get its next command. It uses getc() to read characters
from libc up until \n. Libc has buffered a potentially much
larger chunk of stdin. When it sees the "export\n" command, it
forks "git fast-import" to read the stream.
If fast-export finishes before git fast-import starts, the
fast-export output can end up in libc's buffer in
git-remote-testgit, rather than in git fast-import. The latter
hangs indefinitely on a now-empty stdin.
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
0 files changed, 0 insertions, 0 deletions