Skip to content

Commit ded86b4

Browse files
mblowceejatec
authored andcommitted
Add Topic Option To Gerrit Submit (#4)
git gerrit submit [-t topic] optionally configures the Gerrit patchset with the specified topic
1 parent 764107c commit ded86b4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

git-gerrit

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ usage()
77
{
88
echo "Usage: git gerrit init [-u <gerrit URL>] [-p <project name>]"
99
echo " git gerrit update [-b <target branch>]"
10-
echo " git gerrit submit [-b <target branch>] [-d]"
10+
echo " git gerrit submit [-b <target branch>] [-d] [-t topic]"
1111
echo " git gerrit new"
1212
exit
1313
}
@@ -140,7 +140,8 @@ gerrit_submit()
140140
# Determine target branch
141141
target=$(get_upstream)
142142
reffor=for
143-
while getopts "b:d" OPTION
143+
unset topicspec
144+
while getopts "b:dt:" OPTION
144145
do
145146
case $OPTION in
146147
b)
@@ -150,6 +151,10 @@ gerrit_submit()
150151
reffor=drafts
151152
echo Submitting as DRAFT
152153
;;
154+
t)
155+
topicspec=/$OPTARG
156+
echo Submitting with topic: $OPTARG
157+
;;
153158
esac
154159
done
155160

@@ -218,7 +223,7 @@ EOF
218223
echo "Merge successful - please provide a meaningful commit message"
219224
echo
220225
git commit
221-
git push gerrit HEAD:refs/${reffor}/$target
226+
git push gerrit HEAD:refs/${reffor}/${target}${topicspec}
222227

223228
# Save commit message for next time, and switch back to working branch
224229
git log -1 --format=%B --no-color > $DATADIR/msg-$branchid

0 commit comments

Comments
 (0)