Merge pull request #552 from mcarmonaa/fix/packp-adv-refs-encode

packp: fixed encoding when HEAD is not a valid ref