git -C pkgsrc rev-parse HEAD, with pkgsrc/ inside a git checkout and without a
pkgsrc/.git (as the source set carries it), walks up the directory chain and
answers with the outer repository's commit: measured on makronix-build, where
it compared PINS against e57d47bd3b (the Makronix commit) instead of the pkgsrc
pin and stopped make sourcesets with "PINS differs". --git-dir names the
repository explicitly, so a missing one fails instead of answering for another.
The check also feeds emit into a file now: a die inside a pipeline only ends the
subshell and the comparison then reported "differs" on top of the real reason.