Today i was wondering why a branch that was deleted on the remote repository does not get marked as removed in the Pipeline Multibranch Projekt.
So I did a couple of "Scan Multibranch Pipeline Now" and had a closer look at the log, but while the statements seemed ok in the first place, the branches are still all listed and even though a prune option is on the fetch they did not get removed.
so i was looking into the <JENKINS_HOME>/cache directory and fired a couple of git commands manually:
but nothing happened to the refs/remotes/origin/bugfix... (that should haved been removed)
after more investigation I stumbled upon the following command and compared the output to my local copy and the surprise was that all branches in the jenkins cache does not seem to be tracked:
The only difference I could find was that in the .git/config
the fetch line was missing. After I added that in a local copy and made a git fetch --prune the stale branches got removed.
I also replayed the commands from the Multibranch Scan Log with a local git (git version 2.13.0.windows.1) and had the same problems - the remote references where fetched but not tracked.
I hope I did not miss a thing here and you can fix this.
Update: Jenkins is using the command line git in version 1.7.1