diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-02-15 11:35:33 +0100 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-02-22 17:04:23 +0100 |
commit | c1b5e8c42bca585c2bc728a0583b20095bd8c128 (patch) | |
tree | b70cce66af1d9834bb37515a3e01167f1ab5a588 /src/branch.c | |
parent | 0309e85045bfb143c172b3342293d98d687e8092 (diff) | |
download | libgit2-c1b5e8c42bca585c2bc728a0583b20095bd8c128.tar.gz |
branch: Make git_branch_remote_name() cope with orphaned heads
Diffstat (limited to 'src/branch.c')
-rw-r--r-- | src/branch.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/branch.c b/src/branch.c index 11ecbe9a1..a50387541 100644 --- a/src/branch.c +++ b/src/branch.c @@ -323,7 +323,7 @@ int git_branch_remote_name( char *remote_name_out, size_t buffer_size, git_repository *repo, - git_reference *branch) + const char *canonical_branch_name) { git_strarray remote_list = {0}; size_t i, remote_name_size; @@ -332,15 +332,15 @@ int git_branch_remote_name( int error = 0; char *remote_name = NULL; - assert(branch); + assert(repo && canonical_branch_name); if (remote_name_out && buffer_size) *remote_name_out = '\0'; /* Verify that this is a remote branch */ - if (!git_reference_is_remote(branch)) { - giterr_set(GITERR_INVALID, - "Reference '%s' is not a remote branch.", branch->name); + if (!git_reference__is_remote(canonical_branch_name)) { + giterr_set(GITERR_INVALID, "Reference '%s' is not a remote branch.", + canonical_branch_name); error = GIT_ERROR; goto cleanup; } @@ -358,7 +358,7 @@ int git_branch_remote_name( /* Defensivly check that we have a fetchspec */ if (fetchspec && - git_refspec_dst_matches(fetchspec, branch->name)) { + git_refspec_dst_matches(fetchspec, canonical_branch_name)) { /* If we have not already set out yet, then set * it to the matching remote name. Otherwise * multiple remotes match this reference, and it |