fetch: drop unneeded NULL-check for `remote_ref`

Drop the `NULL` check for `remote_ref` in `update_local_ref()`. The function only has a single caller, and that caller always passes in a non-`NULL` value. This fixes a false positive in Coverity. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed May 17, 2023 at 13:48 UTC 6bc7a37e79876092b42a89156a8c24d0a60bd672
1 file changed +2 -3
builtin/fetch.c
+2 -3
@@ -953,11 +953,10 @@ static int update_local_ref(struct ref *ref,
953 * Base this on the remote's ref name, as it's
954 * more likely to follow a standard layout.
955 */
956 - const char *name = remote_ref ? remote_ref->name : "";
957 - if (starts_with(name, "refs/tags/")) {
956 + if (starts_with(remote_ref->name, "refs/tags/")) {
957 msg = "storing tag";
958 what = _("[new tag]");
960 - } else if (starts_with(name, "refs/heads/")) {
959 + } else if (starts_with(remote_ref->name, "refs/heads/")) {
960 msg = "storing head";
961 what = _("[new branch]");
962 } else {