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

Method spelling_of

atomic-repository/src/worktree_presence.rs:111–127  ·  view source on GitHub ↗

The on-disk spelling of `name`: the same bytes, or the entry whose composed form equals `name`'s composed form.

(&self, name: &OsStr)

Source from the content-addressed store, hash-verified

109 /// The on-disk spelling of `name`: the same bytes, or the entry whose
110 /// composed form equals `name`'s composed form.
111 fn spelling_of(&self, name: &OsStr) -> Option<&OsStr> {
112 if let Some(exact) = self.names.get(name) {
113 return Some(exact.as_os_str());
114 }
115 let text = name.to_str()?;
116 let composed: Cow<str> = if is_nfc(text) {
117 Cow::Borrowed(text)
118 } else {
119 Cow::Owned(text.nfc().collect())
120 };
121 if let Some(stored) = self.names.get(OsStr::new(composed.as_ref())) {
122 return Some(stored.as_os_str());
123 }
124 self.composed
125 .get(composed.as_ref())
126 .map(OsString::as_os_str)
127 }
128}
129
130/// The entries of `directory` when it is a real directory (not a symlink

Callers 1

exact_metadataMethod · 0.80

Calls 3

as_refMethod · 0.80
getMethod · 0.65
collectMethod · 0.45

Tested by

no test coverage detected