Set the correct `GL_PROTOCOL` in the environment when rebasing.

Merged Patricio Cano requested to merge set-gl-protocol-on-rebase into master

@stanhu I tested the changes locally and they seem to work.

I'm not sure how to add tests for this, however.