git: 66a56e411ced - main - mfc-candidates: Support GitHub mirror naming conventions

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Thu, 31 Oct 2024 14:58:14 UTC
The branch main has been updated by emaste:

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

commit 66a56e411cedc4f4891063e0d8f2378231d0d124
Author:     Pat Maddox <pat@patmaddox.com>
AuthorDate: 2024-10-18 02:03:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-31 14:57:31 +0000

    mfc-candidates: Support GitHub mirror naming conventions
    
    GitHub repository mirrors are named freebsd-src and
    freebsd-ports. Additionally, GitHub permits remote URLs with or
    without the .git suffix.
    
    Signed-off-by: Pat Maddox <pat@patmaddox.com>
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1483
---
 tools/tools/git/mfc-candidates.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tools/git/mfc-candidates.sh b/tools/tools/git/mfc-candidates.sh
index c232a1ad3345..7af4d29df67e 100644
--- a/tools/tools/git/mfc-candidates.sh
+++ b/tools/tools/git/mfc-candidates.sh
@@ -33,14 +33,14 @@ from_branch=freebsd/main
 author="${USER}"
 
 # Get the FreeBSD repository
-repo=$(basename "$(git remote get-url freebsd 2>/dev/null)" 2>/dev/null)
+repo=$(basename "$(git remote get-url freebsd 2>/dev/null)" .git 2>/dev/null)
 
-if [ "${repo}" = "ports.git" ]; then
+if [ "${repo}" = "ports" -o "${repo}" = "freebsd-ports" ]; then
 	year=$(date '+%Y')
 	month=$(date '+%m')
 	qtr=$(((month-1) / 3 + 1))
 	to_branch="freebsd/${year}Q${qtr}"
-elif [ "${repo}" = "src.git" ]; then
+elif [ "${repo}" = "src" -o "${repo}" = "freebsd-src" ]; then
 	to_branch=freebsd/stable/14
 	# If pwd is a stable or release branch tree, default to it.
 	cur_branch=$(git symbolic-ref --short HEAD 2>/dev/null)