Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demonstrating Gerrit issue 9498: Trigger Gerrit server error on diff
# 0) Create Gerrit dev instance, create project 'foo', clone it, etc.
export GERRIT_PROJECT=foo
# Have set up a ~/.ssh/config with 'Host ${GERRIT_HOST}' configuration that sets
# user and port.
export GERRIT_HOST=testgerrit
git clone ssh://${GERRIT_HOST}/$GERRIT_PROJECT
cd $GERRIT_PROJECT
scp -p ${GERRIT_HOST}:hooks/commit-msg .git/hooks/
git config --local user.name Administrator
git config --local user.email admin@example.com
git checkout -b issue9498 origin/master
# 1) Create some random file with a few lines into the empty repository and
# push that as patch set 1.
cp /etc/lsb-release somerandomfile
git add somerandomfile
git commit -m "Demonstrating Issue 9498"
git push origin HEAD:refs/for/master
# 2) Add a comment in Gerrit UI on some line in the file. Press <ENTER> when you've published the comment.
read
# 3) Rename it in patch set 2.
git mv somerandomfile newnameofrandomfile
git commit --amend --no-edit
git push origin HEAD:refs/for/master
# 4) Open the change in Gerrit UI, select diff from Patch set 1 -> Patch set 2.
# 5) Notice both the old and new file name are listed (rather than only a rename, due to the comment).
# 6) Expand 'somerandomfile' (still on diff Patch set 1 -> Patch set 2).
# Observe server error and HTTP/500 response.
# reset
git checkout origin/master
git branch -D issue9498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.