build: simplify git_init()

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-05-25 16:56:44 +01:00
parent db06bbdb6e
commit 48c2cef800
1 changed files with 5 additions and 10 deletions

15
build
View File

@ -68,20 +68,15 @@ install_packages()
git_init() git_init()
{ {
[ -L ".git" ] && $err "Reference .git is a symlink" [ -L ".git" ] && return 1
[ -e ".git" ] && return 0 [ -e ".git" ] && return 0
eval "$(setvars "$(date -Rud @${versiondate})" cdate _nogit)" eval "$(setvars "$(date -Rud @${versiondate})" cdate _nogit)"
git init 1>/dev/null 2>/dev/null || \ git init || return 1
$err "${PWD}: cannot initialise Git repository" git add -A . || return 1
git add -A . 1>/dev/null 2>/dev/null || \
$err "${PWD}: cannot add files to Git repository"
git commit -m "${projectname} ${version}" --date "${cdate}" \ git commit -m "${projectname} ${version}" --date "${cdate}" \
--author="xbmk <xbmk@example.com>" 1>/dev/null 2>/dev/null || \ --author="xbmk <xbmk@example.com>" || return 1
$err "$PWD: can't commit ${projectname}/${version}, date $cdate" git tag -a "${version}" -m "${projectname} ${version}" || return 1
git tag -a "${version}" -m "${projectname} ${version}" \
1>/dev/null 2>/dev/null || \
$err "${PWD}: cannot git-tag ${projectname}/${version}"
} }
mkrelease() mkrelease()