From b4fca4f036fdebbbaefb5e65060c19b53b54ebb3 Mon Sep 17 00:00:00 2001 From: emilylange Date: Fri, 14 Nov 2025 13:57:27 +0100 Subject: [PATCH] mirror-nixos-branch: fix git `fatal: bad object` error When I wrote 30efa0ad83c00b200acc8959499f71ded897191c, I had the assumption that the GIT_DIR in /home/hydra-mirror/nixpkgs-channels is always up-to-date, but it isn't. The actual local GIT_DIR only gets updated far further down (line 346). This commit fixes the issue of git not yet knowing the $rev by fetching only that $rev early, instead of moving the much more expensive git remote update that would update all branches of nixpkgs, all the time. --- mirror-nixos-branch.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/mirror-nixos-branch.pl b/mirror-nixos-branch.pl index bac4cb7..f0b4517 100755 --- a/mirror-nixos-branch.pl +++ b/mirror-nixos-branch.pl @@ -108,6 +108,7 @@ sub fetch { my $rev = $evalInfo->{jobsetevalinputs}->{nixpkgs}->{revision} or die; # Get commit date of $rev as unixtime and formatted string +run("git fetch origin $rev >&2") or die; my $revUnix = `git show --no-patch --format='%ct' $rev` or die; my $revDate = strftime("%F %T %Z", localtime($revUnix));