MCPcopy Create free account
hub / github.com/git/git / is_root_ref

Function is_root_ref

refs.c:915–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913}
914
915int is_root_ref(const char *refname)
916{
917 static const char *const irregular_root_refs[] = {
918 "HEAD",
919 "AUTO_MERGE",
920 "BISECT_EXPECTED_REV",
921 "NOTES_MERGE_PARTIAL",
922 "NOTES_MERGE_REF",
923 "MERGE_AUTOSTASH",
924 };
925 size_t i;
926
927 if (!is_root_ref_syntax(refname) ||
928 is_pseudo_ref(refname))
929 return 0;
930
931 if (ends_with(refname, "_HEAD"))
932 return 1;
933
934 for (i = 0; i < ARRAY_SIZE(irregular_root_refs); i++)
935 if (!strcmp(refname, irregular_root_refs[i]))
936 return 1;
937
938 return 0;
939}
940
941static int is_current_worktree_ref(const char *ref) {
942 return is_root_ref_syntax(ref) || is_per_worktree_ref(ref);

Callers 7

ref_kind_from_refnameFunction · 0.85
refs_fsck_symrefFunction · 0.85
for_each_root_refFunction · 0.85
files_fsck_refs_nameFunction · 0.85
cmd_reflog_writeFunction · 0.85

Calls 3

is_root_ref_syntaxFunction · 0.85
is_pseudo_refFunction · 0.85
ends_withFunction · 0.85

Tested by

no test coverage detected