| 345 | } |
| 346 | |
| 347 | func TestClientConfigPropagatesGitError(t *testing.T) { |
| 348 | // Given a client whose repository directory does not exist |
| 349 | client := Client{RepoDir: filepath.Join(t.TempDir(), "missing")} |
| 350 | |
| 351 | // When configuration is read |
| 352 | value, err := client.Config(t.Context(), "credential.helper") |
| 353 | |
| 354 | // Then the Git error is returned unchanged |
| 355 | require.Error(t, err) |
| 356 | var gitErr *GitError |
| 357 | require.ErrorAs(t, err, &gitErr) |
| 358 | assert.NotZero(t, gitErr.ExitCode) |
| 359 | assert.Contains(t, gitErr.Stderr, client.RepoDir) |
| 360 | assert.Empty(t, value) |
| 361 | } |
| 362 | |
| 363 | func TestClientUncommittedChangeCountReturnsZeroForCleanRepository(t *testing.T) { |
| 364 | // Given a clean repository |