Use libgit2 git_reference_is_valid_name() to validate branch name

This covers more cases then our own checking

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>