git: 6baddb6b1176 - main - release.sh: Don't install git if already present

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 29 Mar 2024 07:13:09 UTC
The branch main has been updated by cperciva:

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

commit 6baddb6b117664f51e2b1d2427fced946913a08f
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-03-29 07:10:50 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-03-29 07:12:52 +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
---
 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)