Skip to content

Commit ba753d1

Browse files
committed
refactor: additional and expanded logging
1 parent 765a9c3 commit ba753d1

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/git/mod.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn get_commit_messages_till_head_from_oid(
3333
.map(|oid| match oid {
3434
Ok(oid) => match get_commit_message(&repository, oid) {
3535
Some(commit_message) => {
36-
trace!("Found commit '{}'s message '{:?}'.", oid, commit_message);
36+
trace!("Found commit '{}'s message {:?}.", oid, commit_message);
3737
Some(Commit {
3838
oid,
3939
message: commit_message,
@@ -109,16 +109,21 @@ fn get_repository() -> Repository {
109109

110110
fn get_reference(repository: &Repository, matching: &str) -> Oid {
111111
match repository.resolve_reference_from_short_name(matching) {
112-
Ok(reference) => {
113-
trace!("Found reference '{}'.", reference.name().unwrap());
114-
match reference.peel_to_commit() {
115-
Ok(commit) => commit.id(),
116-
Err(error) => {
117-
error!("{:?}", error);
118-
exit(crate::ERROR_EXIT_CODE);
119-
}
112+
Ok(reference) => match reference.peel_to_commit() {
113+
Ok(commit) => {
114+
trace!(
115+
"Matched {:?} to the reference {:?} at the commit hash '{}'.",
116+
matching,
117+
reference.name().unwrap(),
118+
commit.id()
119+
);
120+
commit.id()
120121
}
121-
}
122+
Err(error) => {
123+
error!("{:?}", error);
124+
exit(crate::ERROR_EXIT_CODE);
125+
}
126+
},
122127
Err(_) => {
123128
error!("Could not find a reference with the name {:?}.", matching);
124129
exit(crate::ERROR_EXIT_CODE);

0 commit comments

Comments
 (0)