MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run

Method run

atomic-cli/src/commands/git/push.rs:97–474  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

95
96impl Command for Push {
97 fn run(&self) -> CliResult<()> {
98 // Preflight through a read-only Atomic handle. This CB-4B gate happens
99 // before writable repository open can recover/create a local operation,
100 // and before any Git exclude/index/ODB/ref mutation.
101 let repo_root = find_repository_root()?;
102 let readonly_repo = Repository::open_readonly(&repo_root).map_err(CliError::Repository)?;
103 let working_copy = readonly_repo
104 .require_working_copy_id()
105 .map_err(CliError::Repository)?;
106 let current_view = readonly_repo
107 .desired_view_name(working_copy)
108 .map_err(CliError::Repository)?;
109 let mut publication =
110 super::shadow::verify_git_publication(&readonly_repo, &repo_root, &current_view)?;
111 // CB-12B: trusted provenance publication gate for Git ref export
112 // (RFC §10.4). Before any commit/ref/ODB mutation, the complete
113 // reachable closure of the exported view must carry trusted
114 // managed-session evidence. This is fail-closed with exact
115 // diagnostics; content correctness is verified independently by the
116 // publication check above.
117 {
118 let view_changes: Vec<atomic_core::types::Hash> = readonly_repo
119 .get_view_changes(Some(&current_view))
120 .map_err(CliError::Repository)?
121 .into_iter()
122 .map(|(_, hash)| hash)
123 .collect();
124 let closure = atomic_repository::repository::provenance_gate::reachable_closure(
125 &readonly_repo,
126 &view_changes,
127 )
128 .map_err(CliError::Repository)?;
129 let provider =
130 atomic_repository::repository::provenance_gate::local_session_mac_key_provider(
131 &readonly_repo,
132 );
133 let did_provider =
134 atomic_repository::repository::provenance_gate::local_did_key_provider(
135 &readonly_repo,
136 );
137 readonly_repo
138 .enforce_publication_gate(
139 "Git ref export",
140 &closure,
141 Some(&provider),
142 Some(&did_provider),
143 )
144 .map_err(CliError::Repository)?;
145 }
146 // RFC §8.3 (CB-8B): remote export of a view with unresolved Atomic
147 // conflicts is refused by default. Even with --allow-conflicts the
148 // complete conflict-object pack must already be published and verify
149 // against the CURRENT conflict set — markers plus a hash are
150 // insufficient, and the flag cannot bless a missing or stale pack.
151 {
152 let conflicted = readonly_repo
153 .capture_view_conflict_set(&current_view)
154 .map_err(CliError::Repository)?

Callers

nothing calls this directly

Calls 15

find_repository_rootFunction · 0.85
verify_git_publicationFunction · 0.85
reachable_closureFunction · 0.85
local_did_key_providerFunction · 0.85
RepositoryClass · 0.85
validate_conflicts_packFunction · 0.85
openFunction · 0.85
acquire_shadow_lockFunction · 0.85
print_infoFunction · 0.85
stderrFunction · 0.85

Tested by

no test coverage detected