Fetch submodule changes from the copied repository back to the original repository. This ensures that commits made by the agent in submodules are available in the original repo. The branch_name is used to create matching branch names in the submodule. Returns any non-fatal warnings encountered during the fetch.
(
&self,
copied_repo: &Path,
original_repo: &Path,
branch_name: &str,
)
| 942 | /// The branch_name is used to create matching branch names in the submodule. |
| 943 | /// Returns any non-fatal warnings encountered during the fetch. |
| 944 | async fn fetch_submodule_changes( |
| 945 | &self, |
| 946 | copied_repo: &Path, |
| 947 | original_repo: &Path, |
| 948 | branch_name: &str, |
| 949 | ) -> Result<Vec<String>, String> { |
| 950 | let submodules = self.parse_gitmodules(copied_repo).await?; |
| 951 | |
| 952 | if submodules.is_empty() { |
| 953 | return Ok(Vec::new()); |
| 954 | } |
| 955 | |
| 956 | let mut warnings = Vec::new(); |
| 957 | |
| 958 | for submodule in submodules { |
| 959 | // Wrap each submodule fetch in error handling - collect warnings but don't fail overall |
| 960 | if let Err(e) = self |
| 961 | .fetch_single_submodule_changes(copied_repo, original_repo, &submodule, branch_name) |
| 962 | .await |
| 963 | { |
| 964 | warnings.push(format!( |
| 965 | "Failed to fetch changes for submodule '{}': {}", |
| 966 | submodule.path, e |
| 967 | )); |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | Ok(warnings) |
| 972 | } |
| 973 | |
| 974 | /// Fetch changes for a single submodule from copied repo to original repo. |
| 975 | /// The branch_name is used to create a matching branch in the original submodule. |
no test coverage detected