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

Function extract_commit_metadata

atomic-cli/src/commands/git/parallel.rs:4253–4274  ·  view source on GitHub ↗

Extract metadata from a git commit.

(commit: &git2::Commit)

Source from the content-addressed store, hash-verified

4251
4252/// Extract metadata from a git commit.
4253fn extract_commit_metadata(commit: &git2::Commit) -> CliResult<CommitMetadata> {
4254 let author = commit.author();
4255 let author_name = author.name().unwrap_or("Unknown").to_string();
4256 let author_email = author.email().map(|s| s.to_string());
4257
4258 let time = commit.time();
4259 let timestamp = Utc
4260 .timestamp_opt(time.seconds(), 0)
4261 .single()
4262 .unwrap_or_else(Utc::now);
4263
4264 let full_message = commit.message().unwrap_or("");
4265 let (message, description) = parse_commit_message(full_message);
4266
4267 Ok(CommitMetadata {
4268 author_name,
4269 author_email,
4270 timestamp,
4271 message,
4272 description,
4273 })
4274}
4275
4276/// Parse files from a git diff.
4277///

Callers 1

parse_commitFunction · 0.85

Calls 6

parse_commit_messageFunction · 0.85
authorMethod · 0.80
emailMethod · 0.80
singleMethod · 0.80
nameMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected