diff options
Diffstat (limited to 'src/git.rs')
| -rw-r--r-- | src/git.rs | 17 |
1 files changed, 17 insertions, 0 deletions
| @@ -245,6 +245,23 @@ mod tests { | |||
| 245 | 245 | ||
| 246 | use super::*; | 246 | use super::*; |
| 247 | 247 | ||
| 248 | #[test] | ||
| 249 | fn get_commit_parent() -> Result<()> { | ||
| 250 | let test_repo = GitTestRepo::default(); | ||
| 251 | let parent_oid = test_repo.populate()?; | ||
| 252 | std::fs::write(test_repo.dir.join("t100.md"), "some content")?; | ||
| 253 | let child_oid = test_repo.stage_and_commit("add t100.md")?; | ||
| 254 | |||
| 255 | let git_repo = Repo::from_path(&test_repo.dir)?; | ||
| 256 | |||
| 257 | assert_eq!( | ||
| 258 | // Sha1Hash::from_byte_array("bla".to_string().as_bytes()), | ||
| 259 | oid_to_sha1(&parent_oid), | ||
| 260 | git_repo.get_commit_parent(&oid_to_sha1(&child_oid))?, | ||
| 261 | ); | ||
| 262 | Ok(()) | ||
| 263 | } | ||
| 264 | |||
| 248 | mod make_patch_from_commit { | 265 | mod make_patch_from_commit { |
| 249 | use super::*; | 266 | use super::*; |
| 250 | #[test] | 267 | #[test] |