Removing logic from get_note_for_commit which sets the ref of the note into a reusable function