diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-07-30 08:56:51 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-07-30 08:56:51 -0400 |
| commit | cc68c19a3a6f025d94e332e856f43ab438dfbf08 (patch) | |
| tree | 3224a0ba8e3c783418722829be97ad297e5d263a /src | |
| parent | 47dd9f47972f0885b288a950714568c98f16a79e (diff) | |
| parent | f2915ec488898efe956c90c322fff67d0030f92f (diff) | |
| download | libgit2-cc68c19a3a6f025d94e332e856f43ab438dfbf08.tar.gz | |
Merge branch 'pr/5861'
Diffstat (limited to 'src')
| -rw-r--r-- | src/branch.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/branch.c b/src/branch.c index 29ff0b9d9..e6818a86d 100644 --- a/src/branch.c +++ b/src/branch.c @@ -468,7 +468,7 @@ cleanup: return error; } -int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname) +static int git_branch_upstream_with_format(git_buf *buf, git_repository *repo, const char *refname, const char *format, const char *format_name) { int error; git_config *cfg; @@ -480,11 +480,11 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r return error; if ((error = git_buf_sanitize(buf)) < 0 || - (error = retrieve_upstream_configuration(buf, cfg, refname, "branch.%s.remote")) < 0) + (error = retrieve_upstream_configuration(buf, cfg, refname, format)) < 0) return error; if (git_buf_len(buf) == 0) { - git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream remote", refname); + git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream %s", refname, format_name); error = GIT_ENOTFOUND; git_buf_clear(buf); } @@ -492,6 +492,16 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r return error; } +int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname) +{ + return git_branch_upstream_with_format(buf, repo, refname, "branch.%s.remote", "remote"); +} + +int git_branch_upstream_merge(git_buf *buf, git_repository *repo, const char *refname) +{ + return git_branch_upstream_with_format(buf, repo, refname, "branch.%s.merge", "merge"); +} + int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refname) { git_strarray remote_list = {0}; |
