Fix a test failure. Not sure why I haven't seen this before.
Fix the tag lookup logic, as seen in libgit2/libgit2sharp#498.

Also move the logic to basic C string operations.