- * Run "rev-list --stdin | pack-objects" pipe.
- */
-static void rev_list(struct ref *refs)
-{
- int pipe_fd[2];
- pid_t pack_objects_pid;
-
- if (pipe(pipe_fd) < 0)
- die("rev-list setup: pipe failed");
- pack_objects_pid = fork();
- if (!pack_objects_pid) {
- /* The child becomes pack-objects; reads from pipe
- * and writes to the original fd
- */
- dup2(pipe_fd[0], 0);
- close(pipe_fd[0]);
- close(pipe_fd[1]);
- exec_pack_objects();
- die("pack-objects setup failed");
- }
- if (pack_objects_pid < 0)
- die("pack-objects fork failed");
-
- /* We become rev-list --stdin; output goes to pipe. */
- dup2(pipe_fd[1], 1);
- close(pipe_fd[0]);
- close(pipe_fd[1]);
- exec_rev_list(refs);
-}
-
-/*
- * Create "rev-list --stdin | pack-objects" pipe and feed
- * the refs into the pipeline.