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

Method run_push

atomic-cli/src/commands/stash.rs:270–308  ·  view source on GitHub ↗

Execute stash push (save changes).

(
        &self,
        repo: &mut Repository,
        message: Option<String>,
        include_untracked: bool,
        keep: bool,
    )

Source from the content-addressed store, hash-verified

268
269 /// Execute stash push (save changes).
270 fn run_push(
271 &self,
272 repo: &mut Repository,
273 message: Option<String>,
274 include_untracked: bool,
275 keep: bool,
276 ) -> CliResult<()> {
277 // The domain owns the flow (status check, orphan view, raw-bytes
278 // sidecar, materialize); this is the presentation half.
279 let options = StashPushOptions {
280 message: message.or_else(|| self.message.clone()),
281 include_untracked: include_untracked || self.include_untracked,
282 keep: keep || self.keep,
283 };
284 match repo
285 .stash_push(options)
286 .map_err(|message| CliError::Internal(anyhow::anyhow!(message)))?
287 {
288 None => {
289 print_warning("No local changes to save");
290 }
291 Some(entry) => {
292 // Recompute the display reference from the listing (the
293 // entry's index is assigned by stash_list).
294 let stash_ref = repo
295 .stash_list()
296 .map_err(|message| CliError::Internal(anyhow::anyhow!(message)))?
297 .iter()
298 .find(|s| s.view_name == entry.view_name)
299 .map(|s| s.reference())
300 .unwrap_or_else(|| "stash@{0}".to_string());
301 print_success(&format!("Saved working copy to {stash_ref}"));
302 if !keep && !self.keep {
303 print_success("Working copy restored to clean state");
304 }
305 }
306 }
307 Ok(())
308 }
309
310 /// Execute stash pop (apply and delete).
311 fn run_pop(&self, repo: &mut Repository, stash_ref: Option<&str>) -> CliResult<()> {

Callers 2

run_push_onMethod · 0.80
runMethod · 0.80

Calls 7

print_warningFunction · 0.85
print_successFunction · 0.85
stash_pushMethod · 0.80
stash_listMethod · 0.80
referenceMethod · 0.80
cloneMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected