Fix handling of non-main default branches for cloud task submissions (#5069)
## Summary - detect the repository's default branch before submitting a cloud task - expose a helper in `codex_core::git_info` for retrieving the default branch name Fixes #4888 ------ https://chatgpt.com/codex/tasks/task_i_68e96093cf28832ca0c9c73fc618a309
This commit is contained in:
@@ -260,6 +260,16 @@ async fn get_default_branch(cwd: &Path) -> Option<String> {
|
||||
get_default_branch_local(cwd).await
|
||||
}
|
||||
|
||||
/// Determine the repository's default branch name, if available.
|
||||
///
|
||||
/// This inspects remote configuration first (including the symbolic `HEAD`
|
||||
/// reference) and falls back to common local defaults such as `main` or
|
||||
/// `master`. Returns `None` when the information cannot be determined, for
|
||||
/// example when the current directory is not inside a Git repository.
|
||||
pub async fn default_branch_name(cwd: &Path) -> Option<String> {
|
||||
get_default_branch(cwd).await
|
||||
}
|
||||
|
||||
/// Attempt to determine the repository's default branch name from local branches.
|
||||
async fn get_default_branch_local(cwd: &Path) -> Option<String> {
|
||||
for candidate in ["main", "master"] {
|
||||
|
||||
Reference in New Issue
Block a user