Skip to content

Commit

Permalink
remote: check the relevance of the refspec when updating FETCH_HEAD
Browse files Browse the repository at this point in the history
Before trying to rtransform using the given refspec to figure out what
the name of the upstream branch is on the remote, we must make sure that
the target of the refspec applies to the current branch's upstream.
  • Loading branch information
carlosmn committed Nov 3, 2014
1 parent 0f838d2 commit 6d20006
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/remote.c
Expand Up @@ -983,6 +983,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
(error = git_config_get_string(&branch_remote, config, git_buf_cstr(&config_key))) < 0 ||
git__strcmp(git_remote_name(remote), branch_remote) ||
(error = git_branch_upstream_name(&upstream_name, repo, ref_name)) < 0 ||
!git_refspec_dst_matches(spec, git_buf_cstr(&upstream_name)) ||
(error = git_refspec_rtransform(&remote_name, spec, upstream_name.ptr)) < 0) {
/* Not an error if there is no upstream */
if (error == GIT_ENOTFOUND)
Expand Down

0 comments on commit 6d20006

Please sign in to comment.