MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / fix_single_worktree_config

Method fix_single_worktree_config

src/git.rs:908–938  ·  view source on GitHub ↗

Fix a single module config file's worktree path if it uses an absolute path. Returns any warnings about absolute paths that could not be automatically fixed.

(
        &self,
        config_path: &Path,
        _repo_path: &Path,
    )

Source from the content-addressed store, hash-verified

906 /// Fix a single module config file's worktree path if it uses an absolute path.
907 /// Returns any warnings about absolute paths that could not be automatically fixed.
908 async fn fix_single_worktree_config(
909 &self,
910 config_path: &Path,
911 _repo_path: &Path,
912 ) -> Result<Vec<String>, String> {
913 let content = tokio::fs::read_to_string(config_path)
914 .await
915 .map_err(|e| format!("Read error: {}", e))?;
916
917 let mut warnings = Vec::new();
918
919 for line in content.lines() {
920 let trimmed = line.trim_start();
921 if trimmed.starts_with("worktree = ") {
922 let worktree_value = trimmed.strip_prefix("worktree = ").unwrap_or("").trim();
923 // Check if absolute path
924 if worktree_value.starts_with('/') || worktree_value.contains(':') {
925 // Absolute path found - collect warning
926 // Fixing this is complex without knowing the original structure,
927 // so we just warn for now
928 warnings.push(format!(
929 "Absolute worktree path found in {}: {}. Manual fixing may be required.",
930 config_path.display(),
931 worktree_value
932 ));
933 }
934 }
935 }
936
937 Ok(warnings)
938 }
939
940 /// Fetch submodule changes from the copied repository back to the original repository.
941 /// This ensures that commits made by the agent in submodules are available in the original repo.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected