From 06f3ddfd3a32e9038ea36c6e196d71adf1753391 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 14 Nov 2026 02:07:45 +0000 Subject: populate: check each Git work tree once per run git_problems looks through all of a work tree for .git files and directories, which takes long for big ones like nixpkgs. A git source drawn from by a flake-input source got checked three times per run: when delivering it, by resolve, deciding on git+file:, and by derived_state, for the key. populate notes the work trees git_problems found nothing wrong with during the run, and resolve and derived_state get told, so git_flake only checks the rest, e.g. hooks. The git source's script prints checked if it checked the work tree that was there, instead of making a fresh clone. Its commands print to standard error, without getting the standard output populate reads, so nothing they leave running keeps populate waiting. rewrite-cache-gitsource is rewrite-cache-git with a git source. --- pkgs/populate/src/populate.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pkgs/populate/src/populate.rs') diff --git a/pkgs/populate/src/populate.rs b/pkgs/populate/src/populate.rs index 40f86dd..47a9099 100644 --- a/pkgs/populate/src/populate.rs +++ b/pkgs/populate/src/populate.rs @@ -9,7 +9,7 @@ use crate::spec::{Source, Spec}; use serde_json::{Map, Value}; use std::fs; use std::path::PathBuf; -use std::process::Command; +use std::process::{Command, Stdio}; /// Checks the sentinel, makes a backup if asked, delivers each source, and /// prunes if asked. @@ -157,7 +157,13 @@ fn deliver( flag("reclone"), ]; args.extend(excludes); - context.run(&sh::git(), &args) + // With standard input, which Git may ask for credentials on. + let mut command = context.shell(&sh::git(), &args); + command.stdin(Stdio::inherit()); + if run::output(&mut command)? == "checked" { + context.git_checked(path); + } + Ok(()) } "pass" => { let dir = string(settings, "dir")?; -- cgit v1.3.1