aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/git.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-05 23:02:11 +0200
committereldritch horrors <pennae@lix.systems>2024-07-06 12:36:36 +0200
commit4162a66cee97ec16c88d991ef9a6d9baa3740053 (patch)
tree41bcdefb5d85c9c26be3563a3880bc850f41bec3 /src/libfetchers/git.cc
parentb6a08a2fed8a48d3759ea67e958c9f9ec5f44d94 (diff)
libutil: return sources from runProgram2
this much more closely mimics what is actually happening: we're reading data from somewhere else, actively, rather than passively waiting. with the data flow matching the underlying system interactions better we can remove a few sinkToSource calls that merely exists to undo the mismatch caused by not treating subprocess output as a data source to begin with Change-Id: If4abfc2f8398fb5e88c9b91a8bdefd5504bb2d11
Diffstat (limited to 'src/libfetchers/git.cc')
-rw-r--r--src/libfetchers/git.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc
index 75ac926e2..81c579e84 100644
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -688,17 +688,14 @@ struct GitInputScheme : InputScheme
filter = isNotDotGitDirectory;
} else {
- // FIXME: should pipe this, or find some better way to extract a
- // revision.
- auto source = sinkToSource([&](Sink & sink) {
- runProgram2({
- .program = "git",
- .args = { "-C", repoDir, "--git-dir", gitDir, "archive", input.getRev()->gitRev() },
- .standardOut = &sink
- }).wait();
+ auto proc = runProgram2({
+ .program = "git",
+ .args = { "-C", repoDir, "--git-dir", gitDir, "archive", input.getRev()->gitRev() },
+ .captureStdout = true,
});
+ Finally const _wait([&] { proc.wait(); });
- unpackTarfile(*source, tmpDir);
+ unpackTarfile(*proc.stdout(), tmpDir);
}
auto storePath = store->addToStore(name, tmpDir, FileIngestionMethod::Recursive, htSHA256, filter);