git: a0c50eda2987 - main - beinstall.sh: Check correct exit status

From: Joseph Mingrone <jrm_at_FreeBSD.org>
Date: Tue, 03 Jan 2023 14:32:41 UTC
The branch main has been updated by jrm (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=a0c50eda2987334cb165802250b5f5ee9b5cffea

commit a0c50eda2987334cb165802250b5f5ee9b5cffea
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2022-12-19 04:07:11 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2023-01-03 14:27:53 +0000

    beinstall.sh: Check correct exit status
    
    When retrieving the timestamp of the last commit using git-show(1), do
    not pipe the output to head(1), otherwise the return value in $? will be
    for head(1) and not git-show(1).
    
    Approved by:    bapt
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D37742
---
 tools/build/beinstall.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/beinstall.sh b/tools/build/beinstall.sh
index 46c65d87e61a..dfb3c4d64083 100755
--- a/tools/build/beinstall.sh
+++ b/tools/build/beinstall.sh
@@ -181,7 +181,7 @@ MERGEMASTER_CMD="${srcdir}/usr.sbin/mergemaster/mergemaster.sh"
 
 # May be a worktree, in which case .git is a file, not a directory.
 if [ -e .git ] ; then
-    commit_time=$(git show --format='%ct' 2>/dev/null | head -1)
+    commit_time=$(git show -s --format='%ct' 2>/dev/null)
     [ $? -ne 0 ] && errx "Can't lookup git commit timestamp"
     commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S')
 elif [ -d .svn ] ; then