branch: refactor git_branch_remote_name

Return the size we'd need to write to instead of simply an
error. Split the function into two to be used later by the upstream
configuration functions.
branch: add more upstream configuration management

Add functions to set and unset the upstream configuration to
complement the getter we already have.