Create a minimal git repo at dir (init + empty commit so HEAD exists). */
| 73 | |
| 74 | /* Create a minimal git repo at dir (init + empty commit so HEAD exists). */ |
| 75 | static int make_git_repo(const char *dir) { |
| 76 | if (th_mkdir_p(dir) != 0) return -1; |
| 77 | if (git_run(dir, "init -q") != 0) return -1; |
| 78 | if (git_run(dir, "config user.email test@example.com") != 0) return -1; |
| 79 | if (git_run(dir, "config user.name Test") != 0) return -1; |
| 80 | /* Create a file so HEAD points to a real commit. */ |
| 81 | char path[1024]; |
| 82 | snprintf(path, sizeof(path), "%s/.keep", dir); |
| 83 | th_write_file(path, ""); |
| 84 | if (git_run(dir, "add .keep") != 0) return -1; |
| 85 | if (git_run(dir, "commit -q -m init") != 0) return -1; |
| 86 | return 0; |
| 87 | } |
| 88 | #endif /* _WIN32 */ |
| 89 | |
| 90 | #ifndef _WIN32 |
no test coverage detected