[JENKINS-16941] Fix serialisation issue.

It reverts https://github.com/cosmin/git-plugin/commit/a7a9e3d714adc80eab8a9271c79883b6cdf7bd93 which caused the whole issue.