proj/gagit:main commit in: /

Michał Górny <[email protected]> Mon, 03 Aug 2026 19:22:41 +0000 (UTC)
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1785784178.85d606a846f639a228887229db6c796688db00a5.mgorny@gentoo>
commit:     85d606a846f639a228887229db6c796688db00a5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 19:08:15 2026 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 19:09:38 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gagit.git/commit/?id=85d606a8

Support overriding the remote name

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 gagit | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gagit b/gagit
index 12cb9e3..662a1f4 100755
--- a/gagit
+++ b/gagit
@@ -28,6 +28,9 @@ print_help() {
 	echo "Options:"
 	echo "  -e EDITOR, --editor EDITOR"
 	echo "                   Override the editor used (default: \${EDITOR})"
+	echo "  -r REMOTE, --remote REMOTE"
+	echo "                   Specify the Codeberg remote name"
+	echo "                   (default: search for codeberg.org SSH URL)"
 	echo "  -t TOPIC, --topic TOPIC"
 	echo "                   Specify the topic to use (default: branch name)"
 	echo "  -h, --help       Print this help message"
@@ -78,6 +81,7 @@ fj_b64() {
 
 main() {
 	local editor=
+	local remote=
 	local topic=
 
 	while [[ ${#} -gt 0 ]]; do
@@ -101,6 +105,17 @@ main() {
 			--editor=*)
 				editor=${1#*=}
 				;;
+			-r|--remote)
+				[[ ${#} -gt 1 ]] || die "${0}: missing argument to ${1}"
+				remote=${2}
+				shift
+				;;
+			-r*)
+				remote=${1#-r}
+				;;
+			--remote=*)
+				remote=${1#*=}
+				;;
 			-t|--topic)
 				[[ ${#} -gt 1 ]] || die "${0}: missing argument to ${1}"
 				topic=${2}
@@ -128,7 +143,9 @@ main() {
 	# set defaults
 	: "${editor:=${EDITOR:-vim}}"
 
-	local remote=$(find_remote)
+	if [[ -z ${remote} ]]; then
+		remote=$(find_remote)
+	fi
 	[[ -z ${remote} ]] && die "Codeberg remote not found"
 	echo "Codeberg remote: ${remote}" >&2