Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 018e87c

Browse files
author
Stephan Dilly
committed
unittest
1 parent db361a3 commit 018e87c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎asyncgit/src/sync/commit.rs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ mod tests {
9393
use commit::amend;
9494
use git2::Repository;
9595
use std::{fs::File, io::Write, path::Path};
96+
use tempfile::TempDir;
9697

9798
fn count_commits(repo: &Repository, max: usize) -> usize {
9899
let mut items = Vec::new();
@@ -185,4 +186,26 @@ mod tests {
185186

186187
Ok(())
187188
}
189+
190+
#[test]
191+
fn test_commit_unknown_signature() {
192+
let file_path = Path::new("foo");
193+
let td = TempDir::new().unwrap();
194+
let repo = Repository::init(td.path()).unwrap();
195+
let root = repo.path().parent().unwrap();
196+
let repo_path = root.as_os_str().to_str().unwrap();
197+
198+
File::create(&root.join(file_path))
199+
.unwrap()
200+
.write_all(b"test\nfoo")
201+
.unwrap();
202+
203+
stage_add_file(repo_path, file_path).unwrap();
204+
205+
let id = commit(repo_path, "commit msg").unwrap();
206+
207+
let details = get_commit_details(repo_path, id).unwrap();
208+
209+
assert_eq!(details.author.name, "unknown");
210+
}
188211
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /