Skip to content

Instantly share code, notes, and snippets.

@rgolangh
Last active March 30, 2017 07:50
Show Gist options
  • Save rgolangh/b8482bafa29137478cbe60054b05fffc to your computer and use it in GitHub Desktop.
Save rgolangh/b8482bafa29137478cbe60054b05fffc to your computer and use it in GitHub Desktop.
#! /bin/sh
GERRIT_URL=https://gerrit.ovirt.org
function gerrit.change_id() {
git show --shortstat | grep Change-Id | gawk '{print $2}'
}
function gerrit.related.change_id() {
curl -s ${GERRIT_URL}/changes/$(gerrit.change_id)/revisions/current/related | sed '1d' | jq '.[][0] | .commit.commit' | tr -d '"'
}
function gerrit.related.remote_branch() {
git ls-remote -q | grep $(gerrit.related.change_id) | gawk '{print $2}'
}
function gerrit.remote_branch() {
git ls-remote -q | grep $(git rev-parse HEAD) | gawk '{print $2}'
}
@rgolangh
Copy link
Author

rgolangh commented Feb 19, 2017

co-authored with @danielerez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment