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

Function restore_head

atomic-cli/src/commands/git/shadow.rs:1846–1856  ·  view source on GitHub ↗
(git_repo: &GitRepository, snapshot: &ReferenceSnapshot)

Source from the content-addressed store, hash-verified

1844}
1845
1846fn restore_head(git_repo: &GitRepository, snapshot: &ReferenceSnapshot) -> Result<(), git2::Error> {
1847 match snapshot {
1848 ReferenceSnapshot::Missing => match git_repo.find_reference("HEAD") {
1849 Ok(mut reference) => reference.delete(),
1850 Err(error) if error.code() == git2::ErrorCode::NotFound => Ok(()),
1851 Err(error) => Err(error),
1852 },
1853 ReferenceSnapshot::Direct(target) => git_repo.set_head_detached(*target),
1854 ReferenceSnapshot::Symbolic(target) => git_repo.set_head(target),
1855 }
1856}
1857
1858fn restore_reference(
1859 git_repo: &GitRepository,

Callers 1

restoreMethod · 0.85

Calls 2

deleteMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected