Skip to content

Commit 32350e8

Browse files
committed
remote: don't update invalid refs
If a symbolic reference points to something invalid, then do not try to update it.
1 parent c41871e commit 32350e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/remote.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,16 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
11411141
ref_name = git_reference_name(resolved_ref);
11421142
}
11431143

1144+
/*
1145+
* The ref name may be unresolvable - perhaps it's pointing to
1146+
* something invalid. In this case, there is no remote head for
1147+
* this ref.
1148+
*/
1149+
if (!ref_name) {
1150+
error = 0;
1151+
goto cleanup;
1152+
}
1153+
11441154
if ((error = ref_to_update(&update, &remote_name, remote, spec, ref_name)) < 0)
11451155
goto cleanup;
11461156

0 commit comments

Comments
 (0)