(t *testing.T, remoteDir, fileName, fileContent, commitMessage string)
| 387 | } |
| 388 | |
| 389 | func createRemoteCommit(t *testing.T, remoteDir, fileName, fileContent, commitMessage string) { |
| 390 | t.Helper() |
| 391 | // Clone the bare repository to a temporary working directory |
| 392 | workingDir := t.TempDir() |
| 393 | cmd := exec.Command("git", "clone", remoteDir, workingDir) |
| 394 | err := cmd.Run() |
| 395 | require.NoError(t, err, "failed to clone remote repository") |
| 396 | setupGitConfig(t, workingDir) |
| 397 | |
| 398 | // Create and commit the file in the working directory |
| 399 | createCommit(t, workingDir, fileName, fileContent, commitMessage) |
| 400 | |
| 401 | // Push the changes back to the remote repository |
| 402 | cmd = exec.Command("git", "-C", workingDir, "push", "origin", "HEAD") |
| 403 | err = cmd.Run() |
| 404 | require.NoError(t, err, "failed to push changes to remote repository") |
| 405 | } |
| 406 | |
| 407 | func setupGitConfig(t *testing.T, repoPath string) { |
| 408 | t.Helper() |
no test coverage detected