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 <1785783965.36539521f630e353c34593f4a8ab9bcb62a48870.mgorny@gentoo>
commit:     36539521f630e353c34593f4a8ab9bcb62a48870
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 19:06:05 2026 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 19:06:05 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gagit.git/commit/?id=36539521

Support overriding the topic

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

 gagit | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gagit b/gagit
index 97d6fc1..12cb9e3 100755
--- a/gagit
+++ b/gagit
@@ -28,6 +28,8 @@ print_help() {
 	echo "Options:"
 	echo "  -e EDITOR, --editor EDITOR"
 	echo "                   Override the editor used (default: \${EDITOR})"
+	echo "  -t TOPIC, --topic TOPIC"
+	echo "                   Specify the topic to use (default: branch name)"
 	echo "  -h, --help       Print this help message"
 	echo "  -V, --version    Print the version string"
 }
@@ -76,6 +78,7 @@ fj_b64() {
 
 main() {
 	local editor=
+	local topic=
 
 	while [[ ${#} -gt 0 ]]; do
 		case ${1} in
@@ -98,6 +101,17 @@ main() {
 			--editor=*)
 				editor=${1#*=}
 				;;
+			-t|--topic)
+				[[ ${#} -gt 1 ]] || die "${0}: missing argument to ${1}"
+				topic=${2}
+				shift
+				;;
+			-t*)
+				topic=${1#-t}
+				;;
+			--topic=*)
+				topic=${1#*=}
+				;;
 			-*)
 				print_usage >&2
 				exit 1
@@ -126,8 +140,7 @@ main() {
 			;;
 	esac
 
-	# TODO: should we allow a different topic?
-	local topic=${branch}
+	: "${topic:=${branch}}"
 
 	local target=$(find_target_branch "${remote}")
 	[[ -z ${remote} ]] && die "Unable to find a target branch"
@@ -143,7 +156,7 @@ main() {
 
 		# Put a single line title below.
 		# "WIP:" creates a draft.  Remove it to skip draft stage.
-		WIP: ${branch}
+		WIP: ${topic}
 
 		# Put the pull request description below.