Get the default branch name.
(&self, git_repo: &GitRepository)
| 324 | |
| 325 | /// Get the default branch name. |
| 326 | fn get_default_branch(&self, git_repo: &GitRepository) -> CliResult<String> { |
| 327 | // Try HEAD first (current branch) |
| 328 | if let Some(name) = current_git_branch(git_repo) { |
| 329 | return Ok(name); |
| 330 | } |
| 331 | |
| 332 | // Fall back to common default names |
| 333 | for name in &["main", "master"] { |
| 334 | if git_repo.find_branch(name, git2::BranchType::Local).is_ok() { |
| 335 | return Ok(name.to_string()); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | Err(CliError::GitError { |
| 340 | message: "Could not determine default branch".to_string(), |
| 341 | }) |
| 342 | } |
| 343 | |
| 344 | /// Count commits for dry-run mode. |
| 345 | fn count_commits( |
no test coverage detected