aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-27 21:05:18 +0000
committertv <tv@krebsco.de>2026-11-30 14:22:03 +0000
commitf571bbad5f276b19864e19c80a4d5b8ca0f19c0f (patch)
treedc93bdc973dff6f319fcf886564e75b47c483aeb
parent41fe8746f14564ca277e70fb4172dba63d9a3351 (diff)
populate git: name the initial branch of shallow clones
git init, which makes the repository of a shallow clone, advises at length to choose a name for the initial branch, unless init.defaultBranch is set. Setting it for git init alone keeps that quiet, and out of the repository's configuration.
-rw-r--r--pkgs/populate/src/sh.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/populate/src/sh.rs b/pkgs/populate/src/sh.rs
index 1f27b6b..52d41ac 100644
--- a/pkgs/populate/src/sh.rs
+++ b/pkgs/populate/src/sh.rs
@@ -515,7 +515,9 @@ deliver_git() {
if ! test -e "$path"; then
changed=1
if test -n "$shallow"; then
- git init "$path"
+ # With a name for the initial branch, so Git doesn't advise to choose
+ # one.
+ git -c init.defaultBranch=master init "$path"
else
git clone --recurse-submodules -- "$url" "$path"
fi