| 2248 | } |
| 2249 | |
| 2250 | const char *get_template_dir(const char *option_template) |
| 2251 | { |
| 2252 | const char *template_dir = option_template; |
| 2253 | |
| 2254 | if (!template_dir) |
| 2255 | template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT); |
| 2256 | if (!template_dir) { |
| 2257 | static struct template_dir_cb_data data; |
| 2258 | |
| 2259 | if (!data.initialized) { |
| 2260 | git_protected_config(template_dir_cb, &data); |
| 2261 | data.initialized = 1; |
| 2262 | } |
| 2263 | template_dir = data.path; |
| 2264 | } |
| 2265 | if (!template_dir) { |
| 2266 | static char *dir; |
| 2267 | |
| 2268 | if (!dir) |
| 2269 | dir = system_path(DEFAULT_GIT_TEMPLATE_DIR); |
| 2270 | template_dir = dir; |
| 2271 | } |
| 2272 | return template_dir; |
| 2273 | } |
| 2274 | |
| 2275 | #ifdef NO_TRUSTABLE_FILEMODE |
| 2276 | #define TEST_FILEMODE 0 |
no test coverage detected