@@ -468,35 +468,10 @@ int git_branch_upstream_name(
468468 return error ;
469469}
470470
471- typedef enum {
472- GIT_BRANCH_UPSTREAM_FORMAT_REMOTE = 1 ,
473- GIT_BRANCH_UPSTREAM_FORMAT_MERGE = 2
474- } git_branch_upstream_format_type_t ;
475-
476- static const char * git_branch_upstream_format_string_for_id (git_branch_upstream_format_type_t id )
477- {
478- switch (id ) {
479- case GIT_BRANCH_UPSTREAM_FORMAT_REMOTE : return "branch.%s.remote" ;
480- case GIT_BRANCH_UPSTREAM_FORMAT_MERGE : return "branch.%s.merge" ;
481- default : return "" ; // OK?
482- };
483- }
484-
485- static const char * git_branch_upstream_format_name_for_id (git_branch_upstream_format_type_t id )
486- {
487- switch (id ) {
488- case GIT_BRANCH_UPSTREAM_FORMAT_REMOTE : return "remote" ;
489- case GIT_BRANCH_UPSTREAM_FORMAT_MERGE : return "merge" ;
490- default : return "UNDEFINED" ; // OK?
491- };
492- }
493-
494- static int git_branch_upstream_with_format (git_buf * buf , git_repository * repo , const char * refname , git_branch_upstream_format_type_t id )
471+ static int git_branch_upstream_with_format (git_buf * buf , git_repository * repo , const char * refname , const char * format , const char * format_name )
495472{
496473 int error ;
497474 git_config * cfg ;
498- const char * format = git_branch_upstream_format_string_for_id (id );
499- const char * format_name = git_branch_upstream_format_name_for_id (id );
500475
501476 if (!git_reference__is_branch (refname ))
502477 return not_a_local_branch (refname );
@@ -519,12 +494,12 @@ static int git_branch_upstream_with_format(git_buf *buf, git_repository *repo, c
519494
520495int git_branch_upstream_remote (git_buf * buf , git_repository * repo , const char * refname )
521496{
522- return git_branch_upstream_with_format (buf , repo , refname , GIT_BRANCH_UPSTREAM_FORMAT_REMOTE );
497+ return git_branch_upstream_with_format (buf , repo , refname , "branch.%s.remote" , "remote" );
523498}
524499
525500int git_branch_upstream_merge (git_buf * buf , git_repository * repo , const char * refname )
526501{
527- return git_branch_upstream_with_format (buf , repo , refname , GIT_BRANCH_UPSTREAM_FORMAT_MERGE );
502+ return git_branch_upstream_with_format (buf , repo , refname , "branch.%s.merge" , "merge" );
528503}
529504
530505int git_branch_remote_name (git_buf * buf , git_repository * repo , const char * refname )
0 commit comments