diff options
| author | tv <tv@krebsco.de> | 2026-11-27 21:05:10 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-27 21:05:10 +0000 |
| commit | 02ea323bb65d95dedf1af927151fc487452d734f (patch) | |
| tree | b52564e6a62ef09c134001cf05ffea10d9e057a8 /pkgs | |
| parent | 38266f128e528b3e7f17d4cebc30e4acce2db2da (diff) | |
populate git: look at HEAD quietly, also before the first commit
A git source with a commit as ref compared it with what git log printed
for HEAD, which, in the repository git init just made for a shallow
clone, has no commit yet, so git log failed, printing "fatal: your
current branch 'master' does not have any commits yet", which looked like
populate's failure, but wasn't. git rev-parse --verify --quiet HEAD
prints nothing there.
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/populate/src/sh.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/populate/src/sh.rs b/pkgs/populate/src/sh.rs index 77d2463..1f27b6b 100644 --- a/pkgs/populate/src/sh.rs +++ b/pkgs/populate/src/sh.rs @@ -547,7 +547,9 @@ deliver_git() { } if printf %s "$ref" | grep -Eqx '[0-9a-f]{4,40}'; then hash=$ref - if ! test "$(git log --format=%H -1)" = "$hash"; then + # Quietly, also in a repository without commits yet, e.g. a shallow + # one git init just made. + if ! test "$(git rev-parse --verify --quiet HEAD)" = "$hash"; then if test -n "$fetch_always"; then fetch_commit elif ! git log -1 "$hash" >/dev/null 2>&1; then |
