(
manifest: &SourcesManifest,
strict_local: bool,
)
| 6739 | } |
| 6740 | |
| 6741 | fn check_all_manifest_source_checkouts( |
| 6742 | manifest: &SourcesManifest, |
| 6743 | strict_local: bool, |
| 6744 | ) -> Result<()> { |
| 6745 | for source in &manifest.sources { |
| 6746 | let Some(path) = source_checkout_path(source.name.as_str()) else { |
| 6747 | if strict_local { |
| 6748 | bail!("source '{}' has no configured checkout path", source.name); |
| 6749 | } |
| 6750 | eprintln!( |
| 6751 | "warning: source '{}' has no configured checkout path", |
| 6752 | source.name |
| 6753 | ); |
| 6754 | continue; |
| 6755 | }; |
| 6756 | if !path.join(".git").exists() { |
| 6757 | if strict_local { |
| 6758 | bail!("missing local checkout {}", path.display()); |
| 6759 | } |
| 6760 | eprintln!("warning: local checkout {} is missing", path.display()); |
| 6761 | continue; |
| 6762 | } |
| 6763 | let head = command_output("git", &["rev-parse", "HEAD"], path) |
| 6764 | .with_context(|| format!("read HEAD for {}", path.display()))?; |
| 6765 | if head.trim() != source.commit { |
| 6766 | if strict_local { |
| 6767 | bail!( |
| 6768 | "local {} checkout is at {}, expected {} from assets/sources.toml", |
| 6769 | path.display(), |
| 6770 | head.trim(), |
| 6771 | source.commit |
| 6772 | ); |
| 6773 | } |
| 6774 | eprintln!( |
| 6775 | "warning: local {} checkout is at {}, expected {}", |
| 6776 | path.display(), |
| 6777 | head.trim(), |
| 6778 | source.commit |
| 6779 | ); |
| 6780 | } |
| 6781 | let branch = command_output("git", &["branch", "--show-current"], path) |
| 6782 | .unwrap_or_else(|_| String::from("<detached>")); |
| 6783 | if strict_local && branch.trim() != source.branch { |
| 6784 | bail!( |
| 6785 | "local {} checkout is on branch '{}', expected '{}'", |
| 6786 | path.display(), |
| 6787 | branch.trim(), |
| 6788 | source.branch |
| 6789 | ); |
| 6790 | } |
| 6791 | let status = source_checkout_status_for_source(source.name.as_str(), path) |
| 6792 | .with_context(|| format!("read status for {}", path.display()))?; |
| 6793 | if !status.trim().is_empty() { |
| 6794 | if strict_local { |
| 6795 | bail!( |
| 6796 | "local {} checkout ({}) has uncommitted changes; preserve them before strict asset builds", |
| 6797 | path.display(), |
| 6798 | source.name |
no test coverage detected