I have written my own git-extra.eclass. It inherits git-r3.eclass and then adds a function which runs few git commands to retrieve commit hash and tag (if any) and put that information in the package doc directory. I've made this because it's then easy to create new ebuild from installed -9999 live version.
However something has changed and running git commands to query the information will error out:
Code: Select all
fatal: detected dubious ownership in repository at '/var/tmp/portage/dev-games/eureka-1.27-r1/work/eureka-1.27'
To add an exception for this directory, call:
git config --global --add safe.directory /var/tmp/portage/dev-games/eureka-1.27-r1/work/eureka-1.27Code: Select all
fatal: not in a git directoryCode: Select all
git_nfo() {
local git_nfo_file="${T%/}/git_version.nfo"
local TAG CNUM
[[ ! -f "$git_nfo_file" ]] && {
TAG="$(git tag --list --sort=-version:refname | head -n 1)"
echo "tag: ${TAG:-"[notag]"}"
CNUM="$(git rev-list --count ${TAG:+${TAG}..}HEAD)"
echo "commit number (since tag): ${CNUM}"
echo "commit: $(git rev-parse HEAD)"
echo "PF: ${PN}-${TAG}_p${CNUM}"
} > "$git_nfo_file"
case "$1" in
install)
if [[ "$2" ]]
then
newdoc "$git_nfo_file" "$2"
else
dodoc "$git_nfo_file"
fi
;;
*)
cat "$git_nfo_file"
;;
esac
}

