Use git_reference_is_branch instead of manual check