Commit aa12836d by Edward Thomson

remote: safely cope with malformed remote heads

parent 9020162c
...@@ -1116,7 +1116,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re ...@@ -1116,7 +1116,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
git_reference *resolved_ref = NULL; git_reference *resolved_ref = NULL;
git_buf remote_name = GIT_BUF_INIT; git_buf remote_name = GIT_BUF_INIT;
git_config *config = NULL; git_config *config = NULL;
const char *ref_name; const char *ref_name = NULL;
int error = 0, update; int error = 0, update;
assert(out && spec && ref); assert(out && spec && ref);
...@@ -1129,7 +1129,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re ...@@ -1129,7 +1129,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) { if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
ref_name = git_reference_symbolic_target(ref); ref_name = git_reference_symbolic_target(ref);
error = 0; error = 0;
} else { } else if (resolved_ref) {
ref_name = git_reference_name(resolved_ref); ref_name = git_reference_name(resolved_ref);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment