diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2014-11-08 17:05:13 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2014-11-08 17:05:13 -0500 |
| commit | 02bc5233041ba0b83fc8db66e02214c99f1e75fe (patch) | |
| tree | 42c07e3d5a6baa826d327ea5f1fb1a1e692f7a35 /src/branch.c | |
| parent | bc8c4a8aeb7323e6e7431797a2be0d0e0035d9e8 (diff) | |
| parent | 2c9b9c8bb4ffe083ddea7044cdfd07d6985756d6 (diff) | |
| download | libgit2-02bc5233041ba0b83fc8db66e02214c99f1e75fe.tar.gz | |
Merge pull request #2698 from libgit2/cmn/fetchhead-refactor
Refactor fetchhead
Diffstat (limited to 'src/branch.c')
| -rw-r--r-- | src/branch.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/branch.c b/src/branch.c index 9a3cb07ed..01402a2e9 100644 --- a/src/branch.c +++ b/src/branch.c @@ -384,6 +384,29 @@ cleanup: return error; } +int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname) +{ + int error; + const char *str; + git_config *cfg; + + if (!git_reference__is_branch(refname)) + return not_a_local_branch(refname); + + git_buf_sanitize(buf); + if ((error = git_repository_config_snapshot(&cfg, repo)) < 0) + return error; + + if ((error = retrieve_upstream_configuration(&str, cfg, refname, "branch.%s.remote")) < 0) + goto cleanup; + + error = git_buf_puts(buf, str); + +cleanup: + git_config_free(cfg); + return error; +} + int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refname) { git_strarray remote_list = {0}; |
