diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-25 13:40:38 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-25 13:40:38 +0200 |
commit | 23aa7c9037960ca38adce3164cd329e1ba5a752c (patch) | |
tree | 3568698f1cd4e976880430ebe202f5028152b3b0 /src | |
parent | 0c34fa5094ba624ebe398d1b154fd27c207108cb (diff) | |
download | libgit2-cmn/fetch-spec-fetchhead.tar.gz |
remote: insert refspecs with no rhs in FETCH_HEADcmn/fetch-spec-fetchhead
When a refspec contains no rhs and thus won't cause an explicit update,
we skip all the logic, but that means that we don't update FETCH_HEAD
with it, which is what the implicit rhs is.
Add another bit of logic which puts those remote heads in the list of
updates so we put them into FETCH_HEAD.
Diffstat (limited to 'src')
-rw-r--r-- | src/remote.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/remote.c b/src/remote.c index 7c2d99937..8475b1c7b 100644 --- a/src/remote.c +++ b/src/remote.c @@ -1342,9 +1342,20 @@ static int update_tips_for_spec( } else { continue; } - } else if (git_refspec_src_matches(spec, head->name) && spec->dst) { - if (git_refspec_transform(&refname, spec, head->name) < 0) - goto on_error; + } else if (git_refspec_src_matches(spec, head->name)) { + if (spec->dst) { + if (git_refspec_transform(&refname, spec, head->name) < 0) + goto on_error; + } else { + /* + * no rhs mans store it in FETCH_HEAD, even if we don't + update anything else. + */ + if ((error = git_vector_insert(&update_heads, head)) < 0) + goto on_error; + + continue; + } } else { continue; } |