commit 081e3dc235439cbb3e34342349768119ddf4ad49 from: Omar Polo via: Thomas Adam date: Thu Jun 15 11:27:15 2023 UTC got, tog: correctly skip HEAD in build_refs_str() s[strlen(s)] == '\0' is banally always true, the intent was to not skip refs that starts with "HEAD". style nit / ok stsp@ commit - a914c6bf9a936469678bf7398b2a02bfc4107d75 commit + 081e3dc235439cbb3e34342349768119ddf4ad49 blob - 408d6c2eca222e770eac22fefded31612c59a877 blob + c03351b201e51e2910ab2d97e0486faf2b0fe56c --- got/got.c +++ got/got.c @@ -4100,7 +4100,7 @@ build_refs_str(char **refs_str, struct got_reflist_hea continue; name += 8; s = strstr(name, "/" GOT_REF_HEAD); - if (s != NULL && s[strlen(s)] == '\0') + if (s != NULL && strcmp(s, "/" GOT_REF_HEAD) == 0) continue; } err = got_ref_resolve(&ref_id, repo, re->ref); blob - 229ab62ccf36a2c9ae3a6b9dd3c953a0c0f7f184 blob + 31f1f3d7c931e5646bc74db0a358823c32e38196 --- tog/tog.c +++ tog/tog.c @@ -2346,7 +2346,7 @@ build_refs_str(char **refs_str, struct got_reflist_hea if (strncmp(name, "remotes/", 8) == 0) { name += 8; s = strstr(name, "/" GOT_REF_HEAD); - if (s != NULL && s[strlen(s)] == '\0') + if (s != NULL && strcmp(s, "/" GOT_REF_HEAD) == 0) continue; } err = got_ref_resolve(&ref_id, repo, re->ref);