| 913 | } |
| 914 | |
| 915 | int 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 | |
| 941 | static int is_current_worktree_ref(const char *ref) { |
| 942 | return is_root_ref_syntax(ref) || is_per_worktree_ref(ref); |
no test coverage detected