summaryrefslogtreecommitdiff
path: root/builtin-ls-tree.c
diff options
context:
space:
mode:
authorAnders Melchiorsen <mail@cup.kalibalik.dk>2008-08-04 12:18:40 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-04 21:46:42 -0700
commit7d0b18a4da1be9e738293cc13812757ca47ed109 (patch)
tree7dd79690ee16d7af1ccf8a9519c59132599bc35a /builtin-ls-tree.c
parent611921654ffb854338ab758009a93c70054fab7f (diff)
downloadgit-7d0b18a4da1be9e738293cc13812757ca47ed109.tar.gz
Add output flushing before fork()
This adds fflush(NULL) before fork() in start_command(), to keep the generic interface safe. A remaining use of fork() with no flushing is in a comment in show_tree(). Rewrite that comment to use start_command(). Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-ls-tree.c')
-rw-r--r--builtin-ls-tree.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index d25767a1f7..cb61717685 100644
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
@@ -66,17 +66,16 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
/*
* Maybe we want to have some recursive version here?
*
- * Something like:
+ * Something similar to this incomplete example:
*
if (show_subprojects(base, baselen, pathname)) {
- if (fork()) {
- chdir(base);
- exec ls-tree;
- }
- waitpid();
+ struct child_process ls_tree;
+
+ ls_tree.dir = base;
+ ls_tree.argv = ls-tree;
+ start_command(&ls_tree);
}
*
- * ..or similar..
*/
type = commit_type;
} else if (S_ISDIR(mode)) {