git-worktree(1), and Git shared repository can use a plain text file
named `.git` at the root of working tree, containing `gitdir: <path>` to
point to the real directory that has repository.
See: gitrepository-layout(5).
But, that directory is usually inaccessible inside chroot.
In order to support git-worktree(1) and Git shared repository, compute
SOURCE_DATE_EPOCH from outside of chroot, and the chroot will carry it
over to inside chroot.
I've only tested again xbps-uunshare(1).
git-ls-files(1) is plumbing command, its output will never change
regardless of configuration, version.
git-status(1) output will be changed depends on configuration.
At least, 986d4dbc7d (common/environment/setup/git.sh: ensure untracked
files are checked., 2017-11-24) was added to address a different output
on `status.showUntrackedFiles`.
By doing this, also reduce a pipe, and a fork-exec.
Technically, git-log(1) is also a porcelain, but I _think_ `%ct` is
stable enough to stay there. If the day has come, that `git-log(1)` can
be replaced with:
git cat-file commit HEAD |
sed -ne '/^committer/{s/.* \([0-9]*\) [-+][0-9][0-9][0-9][0-9]$/\1/p;q}'
In order to make builds more reproducible SOURCE_DATE_EPOCH was set to
the time of the last commit that touched the template. Since trying to
reproduce a build from a different revision is futile (the most obvious
reason is that the source-revisions property includes the HEAD commit
hash) and looking up the commit in question can take several seconds,
stop wasting time an just use HEAD.
Closes: #12314 [via git-merge-pr]