swipely/jenkins-git-notes-plugin — pull request #3 by tucker250 (2012-04-11 03:13:27+00:00)
Title: Fix overriding notes bug and add tests

@bfulton - First pass at a fix for losing git note history, and a refac to make it possible to unit test the plugin. The core change to fix the bug was to make the git note addition work like this:

1. git fetch -f origin refs/notes/jenkins:refs/notes/jenkins
2. prev_note = `git notes --ref=jenkins show HEAD`
3. git notes --ref=jenkins add -f -m "{:data => value, previous_note => $prev}" HEAD
4. git push origin refs/notes/jenkins

Since a race is possible here if two workers are adding a note to the same commit, if step 4 fails then we restart from step one. Note that the push in step 4 is *not* forced, and the pull in step 1 *is*. GitNotesPublisher will retry up to 3 times before giving up.

One open question is what "giving up on a git note" should entail. Should the build fail?