Get the default branch name.
(&self, git_repo: &GitRepository)
| 348 | |
| 349 | /// Get the default branch name. |
| 350 | fn get_default_branch(&self, git_repo: &GitRepository) -> CliResult<String> { |
| 351 | // Try HEAD first (current branch) |
| 352 | if let Some(name) = current_git_branch(git_repo) { |
| 353 | return Ok(name); |
| 354 | } |
| 355 | |
| 356 | // Fall back to common default names |
| 357 | for name in &["main", "master"] { |
| 358 | if git_repo.find_branch(name, git2::BranchType::Local).is_ok() { |
| 359 | return Ok(name.to_string()); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | Err(CliError::GitError { |
| 364 | message: "Could not determine default branch".to_string(), |
| 365 | }) |
| 366 | } |
| 367 | |
| 368 | /// Count commits for dry-run mode. |
| 369 | fn count_commits( |
no test coverage detected