Fix serialization to slave

Includes https://github.com/jenkinsci/git-plugin/pull/147, along with a similar issue introduced in my previous fix (dd9aa91da5) and unit tests to exhibit bug.