MCPcopy Create free account
hub / github.com/HairlessVillager/minecommit / git_glob_after_commit

Function git_glob_after_commit

minecommit/src/odb/git.rs:302–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300
301 #[test]
302 fn git_glob_after_commit() {
303 let repo = init_bare_repo();
304 let mut odb = LocalGitOdb::from_commit(repo.path().to_path_buf(), String::new()).unwrap();
305
306 odb.put("a/x.rs", &b"fn x(){}".to_vec()).unwrap();
307 odb.put("a/y.rs", &b"fn y(){}".to_vec()).unwrap();
308 odb.put("b/z.md", &b"# Z".to_vec()).unwrap();
309 let commit_sha = odb.commit(&[] as &[&str], "add files", None, None).unwrap();
310
311 let odb = LocalGitOdb::from_commit(repo.path().to_path_buf(), commit_sha).unwrap();
312 let mut matches = odb.glob("a/*.rs").unwrap();
313 matches.sort();
314 assert_eq!(matches, vec!["a/x.rs", "a/y.rs"]);
315 }
316
317 #[test]
318 fn git_commit_with_parent() {

Callers

nothing calls this directly

Calls 4

init_bare_repoFunction · 0.70
putMethod · 0.45
commitMethod · 0.45
globMethod · 0.45

Tested by

no test coverage detected