Skip to content

Commit 6bc7a37

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a40449b commit 6bc7a37

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

builtin/fetch.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,11 +953,10 @@ static int update_local_ref(struct ref *ref,
953953
* Base this on the remote's ref name, as it's
954954
* more likely to follow a standard layout.
955955
*/
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/")) {
958957
msg = "storing tag";
959958
what = _("[new tag]");
960-
} else if (starts_with(name, "refs/heads/")) {
959+
} else if (starts_with(remote_ref->name, "refs/heads/")) {
961960
msg = "storing head";
962961
what = _("[new branch]");
963962
} else {

0 commit comments

Comments
 (0)