| 918 | } |
| 919 | |
| 920 | void read_gitfile_error_die(int error_code, const char *path, const char *dir) |
| 921 | { |
| 922 | switch (error_code) { |
| 923 | case READ_GITFILE_ERR_NOT_A_FILE: |
| 924 | case READ_GITFILE_ERR_STAT_FAILED: |
| 925 | case READ_GITFILE_ERR_MISSING: |
| 926 | case READ_GITFILE_ERR_IS_A_DIR: |
| 927 | /* non-fatal; follow return path */ |
| 928 | break; |
| 929 | case READ_GITFILE_ERR_OPEN_FAILED: |
| 930 | die_errno(_("error opening '%s'"), path); |
| 931 | case READ_GITFILE_ERR_TOO_LARGE: |
| 932 | die(_("too large to be a .git file: '%s'"), path); |
| 933 | case READ_GITFILE_ERR_READ_FAILED: |
| 934 | die(_("error reading %s"), path); |
| 935 | case READ_GITFILE_ERR_INVALID_FORMAT: |
| 936 | die(_("invalid gitfile format: %s"), path); |
| 937 | case READ_GITFILE_ERR_NO_PATH: |
| 938 | die(_("no path in gitfile: %s"), path); |
| 939 | case READ_GITFILE_ERR_NOT_A_REPO: |
| 940 | die(_("not a git repository: %s"), dir); |
| 941 | default: |
| 942 | BUG("unknown error code"); |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | /* |
| 947 | * Try to read the location of the git directory from the .git file, |
no test coverage detected