The one candidate of `path` that names a File of the repository (its * File node in *id); NULL: none, or two. */
| 1775 | /* The one candidate of `path` that names a File of the repository (its |
| 1776 | * File node in *id); NULL: none, or two. */ |
| 1777 | static const char *sh_unique_file(sh_t *s, const char *path, int64_t *id) { |
| 1778 | const char *c[PAIR_LEN] = {NULL, NULL}; |
| 1779 | int n = sh_candidates(s, path, c); |
| 1780 | const char *hit = NULL; |
| 1781 | int found = 0; |
| 1782 | for (int i = 0; i < n; i++) { |
| 1783 | int64_t f = sh_repo_file_id(s, c[i]); |
| 1784 | if (f > 0) { |
| 1785 | found++; |
| 1786 | *id = f; |
| 1787 | hit = c[i]; |
| 1788 | } |
| 1789 | } |
| 1790 | return found == SKIP_ONE ? hit : NULL; |
| 1791 | } |
| 1792 | |
| 1793 | /* The program is a script of the repository -- its path names a file of it, |
| 1794 | * or a shell runs one (bash [-opts] FILE; -c TEXT is no file) -- resolved to |
no test coverage detected