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

Function read_ref

atomic-repository/src/repository/projection_effects.rs:81–87  ·  view source on GitHub ↗
(git: &GitRepository, name: &str)

Source from the content-addressed store, hash-verified

79}
80
81fn read_ref(git: &GitRepository, name: &str) -> Result<Option<GitRefTarget>, RepositoryError> {
82 match git.find_reference(name) {
83 Ok(reference) => reference.target().map(direct_target).transpose(),
84 Err(error) if error.code() == git2::ErrorCode::NotFound => Ok(None),
85 Err(error) => Err(git_map(format!("cannot read Git ref '{name}': {error}"))),
86 }
87}
88
89/// Read the Git HEAD lease value: a direct target when detached, a symbolic
90/// target when attached to an existing branch, and `Ok(None)` when HEAD is

Callers 2

execute_ref_effectMethod · 0.85

Calls 2

git_mapFunction · 0.70
codeMethod · 0.45

Tested by

no test coverage detected