Skip to content
Snippets Groups Projects
Unverified Commit c7243cd8 authored by Casey's avatar Casey :recycle:
Browse files

add a wrapper script using ttq with git push-options (MR 2)


It's possible to push to a branch and open an MR with a single command
on GitLab with

  git push -o merge_request.create

One can also adjust the MR title and description with

  merge_request.title="beep"
  merge_request.description="boop"

However, it isn't possible to include newline literals in git push
options. As a workaround GitLab will automatically convert all '\n'
literals into newlines.

To enable using this with TTQ, add a simple wrapper script which runs
TTQ through awk to convert all newline literals into '\n'.

Signed-off-by: default avatarCaleb Connolly <caleb.connolly@linaro.org>
parent 3bb6be9e
No related branches found
No related tags found
1 merge request!2Make TTQ behave better in scripts
Pipeline #141197 passed
ttqs 0 → 100755
#!/bin/sh -e
# TTQ-WRAPPER
# Wrap the TTQ python script to allow for filtering on stdout such as to
# replace newlines with the literal '\n' to allow # for TTQ output to be
# used in git push-options (which don't allow newlines)
BASEDIR=$(dirname "$(realpath "$0")")
TTQ="$BASEDIR/ttq.py"
if [ ! -f "$TTQ" ]; then
# If this fails the script will abort
TTQ="$(which ttq)"
if grep -q "TTQ-WRAPPER" "$TTQ"; then
echo "Can't find TTQ python script, only this wrapper!" >&2
exit 1
fi
fi
# Invoke TTQ and convert newlines to '\n' literals
$TTQ $* | awk '{printf "%s\\n", $0}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment