Passing variables to commit message via gerrit command line

14 views
Skip to first unread message

Gaurav Negi

unread,
Oct 4, 2016, 11:46:41 PM10/4/16
to Repo and Gerrit Discussion
Dear All,
  I want to pass some message, having variables (say $SOME_VARIABLE) to a gerrit commit

I am using this

   ssh -oStrictHostKeyChecking=no -p 29418 jen...@gerrit.eng.com gerrit review --message '"${SOME_VARIABLE}"'   $GERRIT_PATCHSET_REVISION


However in commit it is coming as ${SOME_VARIABLE} and not expanding its value.

Any idea, how can this be fixed?

Thanks
-Gaurav

Magnus Bäck

unread,
Oct 5, 2016, 2:57:04 AM10/5/16
to Gaurav Negi, Repo and Gerrit Discussion
On Wednesday, October 05, 2016 at 05:46 CEST,
Gaurav Negi <gaura...@gmail.com> wrote:

> I want to pass some message, having variables (say $SOME_VARIABLE) to
> a gerrit commit
> I am using this
> ssh -oStrictHostKeyChecking=no -p 29418 [1]jen...@gerrit.eng.com
> gerrit review --message '"${SOME_VARIABLE}"'
> $GERRIT_PATCHSET_REVISION
> However in commit it is coming as ${SOME_VARIABLE} and not expanding
> its value.

Shell expansions don't take place inside single quotes. Make the string
double-quoted instead:

ssh ... gerrit review --message "${SOME_VARIABLE}"

--
Magnus Bäck | Software Engineer, Firmware Platform Tools
magnu...@axis.com | Axis Communications
Reply all
Reply to author
Forward
0 new messages