Colocated fixture: an Atomic repository over a Git repository with one commit on `dev`.
()
| 1741 | /// Colocated fixture: an Atomic repository over a Git repository with one |
| 1742 | /// commit on `dev`. |
| 1743 | fn colocated() -> (tempfile::TempDir, Repository, String, String) { |
| 1744 | let directory = tempfile::TempDir::new().unwrap(); |
| 1745 | let repo = Repository::init(directory.path()).unwrap(); |
| 1746 | git(directory.path(), &["init", "-b", "dev"]); |
| 1747 | git( |
| 1748 | directory.path(), |
| 1749 | &["config", "user.email", "tests@atomic.dev"], |
| 1750 | ); |
| 1751 | git(directory.path(), &["config", "user.name", "Atomic Tests"]); |
| 1752 | fs::write(directory.path().join("tracked.txt"), b"tracked\n").unwrap(); |
| 1753 | git(directory.path(), &["add", "tracked.txt"]); |
| 1754 | git(directory.path(), &["commit", "-m", "initial"]); |
| 1755 | let head = git(directory.path(), &["rev-parse", "HEAD"]); |
| 1756 | let tree = git(directory.path(), &["rev-parse", "HEAD^{tree}"]); |
| 1757 | (directory, repo, head, tree) |
| 1758 | } |
| 1759 | |
| 1760 | fn working_copy_id(repo: &Repository) -> WorkingCopyId { |
| 1761 | repo.require_working_copy_id().unwrap() |