When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.
Why? Because on the change from P4 -> Git, we can observe the following behaviour:
Setup, Do an admin-like thing and make a git backup of your jenkins master home :
cd into the Jenkins home directory (e.g., /var/lib/jenkins);
git init && git add . && git commit -m `initial commit`
Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
Run the job. Now see that most of the jenkins home is blown away.
This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.
The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory. And cleanup the workspace/<jobname>* (@script in particular) on SCM change.