git: 853241218da2 - stable/13 - release.sh: Don't install git if already present

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 02 Apr 2024 20:44:54 UTC
The branch stable/13 has been updated by cperciva:

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

commit 853241218da2d2eed02e76683b77842451fcdf0f
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-03-29 07:10:50 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-04-02 20:44:46 +0000

    release.sh: Don't install git if already present
    
    Prior to this commit, we install git from ports if there is a ports
    tree available and git is not installed, and we install git from pkg
    otherwise -- including the case where git is already installed.
    
    Rework the logic to not (re)install git at all if it is already
    installed.
    
    MFC after:      3 days
    
    (cherry picked from commit 6baddb6b117664f51e2b1d2427fced946913a08f)
---
 release/release.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/release/release.sh b/release/release.sh
index 75278a12daa6..c9d0203debd4 100755
--- a/release/release.sh
+++ b/release/release.sh
@@ -252,11 +252,11 @@ extra_chroot_setup() {
 		cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF}
 	fi
 
-	if [ -z "${NOGIT}" ]; then
-		# Install git from ports or packages if the ports tree is
-		# available and VCSCMD is unset.
-		_gitcmd="$(which git)"
-		if [ -d ${CHROOTDIR}/usr/ports -a -z "${_gitcmd}" ]; then
+	_gitcmd="$(which git)"
+	if [ -z "${NOGIT}" -a -z "${_gitcmd}" ]; then
+		# Install git from ports if the ports tree is available;
+		# otherwise install the pkg.
+		if [ -d ${CHROOTDIR}/usr/ports ]; then
 			# Trick the ports 'run-autotools-fixup' target to do the right
 			# thing.
 			_OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)