diff options
Diffstat (limited to 'src/git.rs')
| -rw-r--r-- | src/git.rs | 176 |
1 files changed, 96 insertions, 80 deletions
| @@ -828,7 +828,7 @@ fn extract_sig_from_patch_tags<'a>( | |||
| 828 | mod tests { | 828 | mod tests { |
| 829 | use std::fs; | 829 | use std::fs; |
| 830 | 830 | ||
| 831 | use test_utils::{generate_repo_ref_event, git::GitTestRepo, TEST_KEY_1_KEYS}; | 831 | use test_utils::{generate_repo_ref_event, git::GitTestRepo}; |
| 832 | 832 | ||
| 833 | use super::*; | 833 | use super::*; |
| 834 | 834 | ||
| @@ -1591,10 +1591,12 @@ mod tests { | |||
| 1591 | 1591 | ||
| 1592 | mod apply_patch { | 1592 | mod apply_patch { |
| 1593 | 1593 | ||
| 1594 | use test_utils::TEST_KEY_1_SIGNER; | ||
| 1595 | |||
| 1594 | use super::*; | 1596 | use super::*; |
| 1595 | use crate::{repo_ref::RepoRef, sub_commands::send::generate_patch_event}; | 1597 | use crate::{repo_ref::RepoRef, sub_commands::send::generate_patch_event}; |
| 1596 | 1598 | ||
| 1597 | fn generate_patch_from_head_commit(test_repo: &GitTestRepo) -> Result<nostr::Event> { | 1599 | async fn generate_patch_from_head_commit(test_repo: &GitTestRepo) -> Result<nostr::Event> { |
| 1598 | let original_oid = test_repo.git_repo.head()?.peel_to_commit()?.id(); | 1600 | let original_oid = test_repo.git_repo.head()?.peel_to_commit()?.id(); |
| 1599 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1601 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| 1600 | generate_patch_event( | 1602 | generate_patch_event( |
| @@ -1602,7 +1604,7 @@ mod tests { | |||
| 1602 | &git_repo.get_root_commit()?, | 1604 | &git_repo.get_root_commit()?, |
| 1603 | &oid_to_sha1(&original_oid), | 1605 | &oid_to_sha1(&original_oid), |
| 1604 | Some(nostr::EventId::all_zeros()), | 1606 | Some(nostr::EventId::all_zeros()), |
| 1605 | &TEST_KEY_1_KEYS, | 1607 | &TEST_KEY_1_SIGNER, |
| 1606 | &RepoRef::try_from(generate_repo_ref_event()).unwrap(), | 1608 | &RepoRef::try_from(generate_repo_ref_event()).unwrap(), |
| 1607 | None, | 1609 | None, |
| 1608 | None, | 1610 | None, |
| @@ -1610,6 +1612,7 @@ mod tests { | |||
| 1610 | &None, | 1612 | &None, |
| 1611 | &[], | 1613 | &[], |
| 1612 | ) | 1614 | ) |
| 1615 | .await | ||
| 1613 | } | 1616 | } |
| 1614 | fn test_patch_applies_to_repository(patch_event: nostr::Event) -> Result<()> { | 1617 | fn test_patch_applies_to_repository(patch_event: nostr::Event) -> Result<()> { |
| 1615 | let test_repo = GitTestRepo::default(); | 1618 | let test_repo = GitTestRepo::default(); |
| @@ -1649,19 +1652,21 @@ mod tests { | |||
| 1649 | 1652 | ||
| 1650 | use super::*; | 1653 | use super::*; |
| 1651 | 1654 | ||
| 1652 | #[test] | 1655 | #[tokio::test] |
| 1653 | fn simple_signature_author_committer_same_as_git_user_0_unixtime_no_pgp_signature() | 1656 | async fn simple_signature_author_committer_same_as_git_user_0_unixtime_no_pgp_signature() |
| 1654 | -> Result<()> { | 1657 | -> Result<()> { |
| 1655 | let source_repo = GitTestRepo::default(); | 1658 | let source_repo = GitTestRepo::default(); |
| 1656 | source_repo.populate()?; | 1659 | source_repo.populate()?; |
| 1657 | fs::write(source_repo.dir.join("x1.md"), "some content")?; | 1660 | fs::write(source_repo.dir.join("x1.md"), "some content")?; |
| 1658 | source_repo.stage_and_commit("add x1.md")?; | 1661 | source_repo.stage_and_commit("add x1.md")?; |
| 1659 | 1662 | ||
| 1660 | test_patch_applies_to_repository(generate_patch_from_head_commit(&source_repo)?) | 1663 | test_patch_applies_to_repository( |
| 1664 | generate_patch_from_head_commit(&source_repo).await?, | ||
| 1665 | ) | ||
| 1661 | } | 1666 | } |
| 1662 | 1667 | ||
| 1663 | #[test] | 1668 | #[tokio::test] |
| 1664 | fn signature_with_specific_author_time() -> Result<()> { | 1669 | async fn signature_with_specific_author_time() -> Result<()> { |
| 1665 | let source_repo = GitTestRepo::default(); | 1670 | let source_repo = GitTestRepo::default(); |
| 1666 | source_repo.populate()?; | 1671 | source_repo.populate()?; |
| 1667 | fs::write(source_repo.dir.join("x1.md"), "some content")?; | 1672 | fs::write(source_repo.dir.join("x1.md"), "some content")?; |
| @@ -1675,11 +1680,13 @@ mod tests { | |||
| 1675 | None, | 1680 | None, |
| 1676 | )?; | 1681 | )?; |
| 1677 | 1682 | ||
| 1678 | test_patch_applies_to_repository(generate_patch_from_head_commit(&source_repo)?) | 1683 | test_patch_applies_to_repository( |
| 1684 | generate_patch_from_head_commit(&source_repo).await?, | ||
| 1685 | ) | ||
| 1679 | } | 1686 | } |
| 1680 | 1687 | ||
| 1681 | #[test] | 1688 | #[tokio::test] |
| 1682 | fn author_name_and_email_not_current_git_user() -> Result<()> { | 1689 | async fn author_name_and_email_not_current_git_user() -> Result<()> { |
| 1683 | let source_repo = GitTestRepo::default(); | 1690 | let source_repo = GitTestRepo::default(); |
| 1684 | source_repo.populate()?; | 1691 | source_repo.populate()?; |
| 1685 | fs::write(source_repo.dir.join("x1.md"), "some content")?; | 1692 | fs::write(source_repo.dir.join("x1.md"), "some content")?; |
| @@ -1693,11 +1700,13 @@ mod tests { | |||
| 1693 | None, | 1700 | None, |
| 1694 | )?; | 1701 | )?; |
| 1695 | 1702 | ||
| 1696 | test_patch_applies_to_repository(generate_patch_from_head_commit(&source_repo)?) | 1703 | test_patch_applies_to_repository( |
| 1704 | generate_patch_from_head_commit(&source_repo).await?, | ||
| 1705 | ) | ||
| 1697 | } | 1706 | } |
| 1698 | 1707 | ||
| 1699 | #[test] | 1708 | #[tokio::test] |
| 1700 | fn comiiter_name_and_email_not_current_git_user_or_author() -> Result<()> { | 1709 | async fn comiiter_name_and_email_not_current_git_user_or_author() -> Result<()> { |
| 1701 | let source_repo = GitTestRepo::default(); | 1710 | let source_repo = GitTestRepo::default(); |
| 1702 | source_repo.populate()?; | 1711 | source_repo.populate()?; |
| 1703 | fs::write(source_repo.dir.join("x1.md"), "some content")?; | 1712 | fs::write(source_repo.dir.join("x1.md"), "some content")?; |
| @@ -1715,13 +1724,15 @@ mod tests { | |||
| 1715 | )?), | 1724 | )?), |
| 1716 | )?; | 1725 | )?; |
| 1717 | 1726 | ||
| 1718 | test_patch_applies_to_repository(generate_patch_from_head_commit(&source_repo)?) | 1727 | test_patch_applies_to_repository( |
| 1728 | generate_patch_from_head_commit(&source_repo).await?, | ||
| 1729 | ) | ||
| 1719 | } | 1730 | } |
| 1720 | 1731 | ||
| 1721 | // TODO: pgp signature | 1732 | // TODO: pgp signature |
| 1722 | 1733 | ||
| 1723 | #[test] | 1734 | #[tokio::test] |
| 1724 | fn unique_author_and_commiter_details() -> Result<()> { | 1735 | async fn unique_author_and_commiter_details() -> Result<()> { |
| 1725 | let source_repo = GitTestRepo::default(); | 1736 | let source_repo = GitTestRepo::default(); |
| 1726 | source_repo.populate()?; | 1737 | source_repo.populate()?; |
| 1727 | fs::write(source_repo.dir.join("x1.md"), "some content")?; | 1738 | fs::write(source_repo.dir.join("x1.md"), "some content")?; |
| @@ -1739,13 +1750,15 @@ mod tests { | |||
| 1739 | )?), | 1750 | )?), |
| 1740 | )?; | 1751 | )?; |
| 1741 | 1752 | ||
| 1742 | test_patch_applies_to_repository(generate_patch_from_head_commit(&source_repo)?) | 1753 | test_patch_applies_to_repository( |
| 1754 | generate_patch_from_head_commit(&source_repo).await?, | ||
| 1755 | ) | ||
| 1743 | } | 1756 | } |
| 1744 | } | 1757 | } |
| 1745 | } | 1758 | } |
| 1746 | 1759 | ||
| 1747 | mod apply_patch_chain { | 1760 | mod apply_patch_chain { |
| 1748 | use test_utils::TEST_KEY_1_KEYS; | 1761 | use test_utils::TEST_KEY_1_SIGNER; |
| 1749 | 1762 | ||
| 1750 | use super::*; | 1763 | use super::*; |
| 1751 | use crate::{ | 1764 | use crate::{ |
| @@ -1754,8 +1767,8 @@ mod tests { | |||
| 1754 | 1767 | ||
| 1755 | static BRANCH_NAME: &str = "add-example-feature"; | 1768 | static BRANCH_NAME: &str = "add-example-feature"; |
| 1756 | // returns original_repo, cover_letter_event, patch_events | 1769 | // returns original_repo, cover_letter_event, patch_events |
| 1757 | fn generate_test_repo_and_events() -> Result<(GitTestRepo, nostr::Event, Vec<nostr::Event>)> | 1770 | async fn generate_test_repo_and_events() |
| 1758 | { | 1771 | -> Result<(GitTestRepo, nostr::Event, Vec<nostr::Event>)> { |
| 1759 | let original_repo = GitTestRepo::default(); | 1772 | let original_repo = GitTestRepo::default(); |
| 1760 | let oid3 = original_repo.populate_with_test_branch()?; | 1773 | let oid3 = original_repo.populate_with_test_branch()?; |
| 1761 | let oid2 = original_repo.git_repo.find_commit(oid3)?.parent_id(0)?; | 1774 | let oid2 = original_repo.git_repo.find_commit(oid3)?.parent_id(0)?; |
| @@ -1767,11 +1780,12 @@ mod tests { | |||
| 1767 | Some(("test".to_string(), "test".to_string())), | 1780 | Some(("test".to_string(), "test".to_string())), |
| 1768 | &git_repo, | 1781 | &git_repo, |
| 1769 | &[oid_to_sha1(&oid1), oid_to_sha1(&oid2), oid_to_sha1(&oid3)], | 1782 | &[oid_to_sha1(&oid1), oid_to_sha1(&oid2), oid_to_sha1(&oid3)], |
| 1770 | &TEST_KEY_1_KEYS, | 1783 | &TEST_KEY_1_SIGNER, |
| 1771 | &RepoRef::try_from(generate_repo_ref_event()).unwrap(), | 1784 | &RepoRef::try_from(generate_repo_ref_event()).unwrap(), |
| 1772 | &None, | 1785 | &None, |
| 1773 | &[], | 1786 | &[], |
| 1774 | )?; | 1787 | ) |
| 1788 | .await?; | ||
| 1775 | 1789 | ||
| 1776 | events.reverse(); | 1790 | events.reverse(); |
| 1777 | 1791 | ||
| @@ -1784,9 +1798,9 @@ mod tests { | |||
| 1784 | mod when_branch_root_is_tip_of_main { | 1798 | mod when_branch_root_is_tip_of_main { |
| 1785 | use super::*; | 1799 | use super::*; |
| 1786 | 1800 | ||
| 1787 | #[test] | 1801 | #[tokio::test] |
| 1788 | fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> { | 1802 | async fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> { |
| 1789 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1803 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1790 | let test_repo = GitTestRepo::default(); | 1804 | let test_repo = GitTestRepo::default(); |
| 1791 | test_repo.populate()?; | 1805 | test_repo.populate()?; |
| 1792 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1806 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1799,9 +1813,9 @@ mod tests { | |||
| 1799 | Ok(()) | 1813 | Ok(()) |
| 1800 | } | 1814 | } |
| 1801 | 1815 | ||
| 1802 | #[test] | 1816 | #[tokio::test] |
| 1803 | fn branch_checked_out() -> Result<()> { | 1817 | async fn branch_checked_out() -> Result<()> { |
| 1804 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1818 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1805 | let test_repo = GitTestRepo::default(); | 1819 | let test_repo = GitTestRepo::default(); |
| 1806 | test_repo.populate()?; | 1820 | test_repo.populate()?; |
| 1807 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1821 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1813,9 +1827,9 @@ mod tests { | |||
| 1813 | Ok(()) | 1827 | Ok(()) |
| 1814 | } | 1828 | } |
| 1815 | 1829 | ||
| 1816 | #[test] | 1830 | #[tokio::test] |
| 1817 | fn patches_get_created_as_commits() -> Result<()> { | 1831 | async fn patches_get_created_as_commits() -> Result<()> { |
| 1818 | let (original_repo, _, patch_events) = generate_test_repo_and_events()?; | 1832 | let (original_repo, _, patch_events) = generate_test_repo_and_events().await?; |
| 1819 | let test_repo = GitTestRepo::default(); | 1833 | let test_repo = GitTestRepo::default(); |
| 1820 | test_repo.populate()?; | 1834 | test_repo.populate()?; |
| 1821 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1835 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1827,9 +1841,9 @@ mod tests { | |||
| 1827 | Ok(()) | 1841 | Ok(()) |
| 1828 | } | 1842 | } |
| 1829 | 1843 | ||
| 1830 | #[test] | 1844 | #[tokio::test] |
| 1831 | fn branch_tip_is_most_recent_patch() -> Result<()> { | 1845 | async fn branch_tip_is_most_recent_patch() -> Result<()> { |
| 1832 | let (original_repo, _, patch_events) = generate_test_repo_and_events()?; | 1846 | let (original_repo, _, patch_events) = generate_test_repo_and_events().await?; |
| 1833 | let test_repo = GitTestRepo::default(); | 1847 | let test_repo = GitTestRepo::default(); |
| 1834 | test_repo.populate()?; | 1848 | test_repo.populate()?; |
| 1835 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1849 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1841,9 +1855,9 @@ mod tests { | |||
| 1841 | Ok(()) | 1855 | Ok(()) |
| 1842 | } | 1856 | } |
| 1843 | 1857 | ||
| 1844 | #[test] | 1858 | #[tokio::test] |
| 1845 | fn previously_checked_out_branch_tip_does_not_change() -> Result<()> { | 1859 | async fn previously_checked_out_branch_tip_does_not_change() -> Result<()> { |
| 1846 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1860 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1847 | let test_repo = GitTestRepo::default(); | 1861 | let test_repo = GitTestRepo::default(); |
| 1848 | test_repo.populate()?; | 1862 | test_repo.populate()?; |
| 1849 | let existing_branch = test_repo.get_checked_out_branch_name()?; | 1863 | let existing_branch = test_repo.get_checked_out_branch_name()?; |
| @@ -1858,9 +1872,9 @@ mod tests { | |||
| 1858 | Ok(()) | 1872 | Ok(()) |
| 1859 | } | 1873 | } |
| 1860 | 1874 | ||
| 1861 | #[test] | 1875 | #[tokio::test] |
| 1862 | fn returns_all_patches_applied() -> Result<()> { | 1876 | async fn returns_all_patches_applied() -> Result<()> { |
| 1863 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1877 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1864 | let test_repo = GitTestRepo::default(); | 1878 | let test_repo = GitTestRepo::default(); |
| 1865 | test_repo.populate()?; | 1879 | test_repo.populate()?; |
| 1866 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1880 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1873,9 +1887,9 @@ mod tests { | |||
| 1873 | mod when_branch_root_is_tip_behind_main { | 1887 | mod when_branch_root_is_tip_behind_main { |
| 1874 | use super::*; | 1888 | use super::*; |
| 1875 | 1889 | ||
| 1876 | #[test] | 1890 | #[tokio::test] |
| 1877 | fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> { | 1891 | async fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> { |
| 1878 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1892 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1879 | let test_repo = GitTestRepo::default(); | 1893 | let test_repo = GitTestRepo::default(); |
| 1880 | test_repo.populate()?; | 1894 | test_repo.populate()?; |
| 1881 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; | 1895 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; |
| @@ -1890,9 +1904,9 @@ mod tests { | |||
| 1890 | Ok(()) | 1904 | Ok(()) |
| 1891 | } | 1905 | } |
| 1892 | 1906 | ||
| 1893 | #[test] | 1907 | #[tokio::test] |
| 1894 | fn branch_checked_out() -> Result<()> { | 1908 | async fn branch_checked_out() -> Result<()> { |
| 1895 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1909 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1896 | let test_repo = GitTestRepo::default(); | 1910 | let test_repo = GitTestRepo::default(); |
| 1897 | test_repo.populate()?; | 1911 | test_repo.populate()?; |
| 1898 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; | 1912 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; |
| @@ -1906,9 +1920,9 @@ mod tests { | |||
| 1906 | Ok(()) | 1920 | Ok(()) |
| 1907 | } | 1921 | } |
| 1908 | 1922 | ||
| 1909 | #[test] | 1923 | #[tokio::test] |
| 1910 | fn branch_tip_is_most_recent_patch() -> Result<()> { | 1924 | async fn branch_tip_is_most_recent_patch() -> Result<()> { |
| 1911 | let (original_repo, _, patch_events) = generate_test_repo_and_events()?; | 1925 | let (original_repo, _, patch_events) = generate_test_repo_and_events().await?; |
| 1912 | let test_repo = GitTestRepo::default(); | 1926 | let test_repo = GitTestRepo::default(); |
| 1913 | test_repo.populate()?; | 1927 | test_repo.populate()?; |
| 1914 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; | 1928 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; |
| @@ -1922,9 +1936,9 @@ mod tests { | |||
| 1922 | Ok(()) | 1936 | Ok(()) |
| 1923 | } | 1937 | } |
| 1924 | 1938 | ||
| 1925 | #[test] | 1939 | #[tokio::test] |
| 1926 | fn previously_checked_out_branch_tip_does_not_change() -> Result<()> { | 1940 | async fn previously_checked_out_branch_tip_does_not_change() -> Result<()> { |
| 1927 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1941 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1928 | let test_repo = GitTestRepo::default(); | 1942 | let test_repo = GitTestRepo::default(); |
| 1929 | test_repo.populate()?; | 1943 | test_repo.populate()?; |
| 1930 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; | 1944 | std::fs::write(test_repo.dir.join("m3.md"), "some content")?; |
| @@ -1941,9 +1955,9 @@ mod tests { | |||
| 1941 | Ok(()) | 1955 | Ok(()) |
| 1942 | } | 1956 | } |
| 1943 | 1957 | ||
| 1944 | #[test] | 1958 | #[tokio::test] |
| 1945 | fn returns_all_patches_applied() -> Result<()> { | 1959 | async fn returns_all_patches_applied() -> Result<()> { |
| 1946 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 1960 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 1947 | let test_repo = GitTestRepo::default(); | 1961 | let test_repo = GitTestRepo::default(); |
| 1948 | test_repo.populate()?; | 1962 | test_repo.populate()?; |
| 1949 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1963 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1962,9 +1976,10 @@ mod tests { | |||
| 1962 | mod when_branch_already_checked_out { | 1976 | mod when_branch_already_checked_out { |
| 1963 | use super::*; | 1977 | use super::*; |
| 1964 | 1978 | ||
| 1965 | #[test] | 1979 | #[tokio::test] |
| 1966 | fn branch_tip_is_most_recent_patch() -> Result<()> { | 1980 | async fn branch_tip_is_most_recent_patch() -> Result<()> { |
| 1967 | let (original_repo, _, mut patch_events) = generate_test_repo_and_events()?; | 1981 | let (original_repo, _, mut patch_events) = |
| 1982 | generate_test_repo_and_events().await?; | ||
| 1968 | let test_repo = GitTestRepo::default(); | 1983 | let test_repo = GitTestRepo::default(); |
| 1969 | test_repo.populate()?; | 1984 | test_repo.populate()?; |
| 1970 | let git_repo = Repo::from_path(&test_repo.dir)?; | 1985 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1978,9 +1993,9 @@ mod tests { | |||
| 1978 | Ok(()) | 1993 | Ok(()) |
| 1979 | } | 1994 | } |
| 1980 | 1995 | ||
| 1981 | #[test] | 1996 | #[tokio::test] |
| 1982 | fn returns_all_patches_applied() -> Result<()> { | 1997 | async fn returns_all_patches_applied() -> Result<()> { |
| 1983 | let (_, _, mut patch_events) = generate_test_repo_and_events()?; | 1998 | let (_, _, mut patch_events) = generate_test_repo_and_events().await?; |
| 1984 | let test_repo = GitTestRepo::default(); | 1999 | let test_repo = GitTestRepo::default(); |
| 1985 | test_repo.populate()?; | 2000 | test_repo.populate()?; |
| 1986 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2001 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -1993,9 +2008,10 @@ mod tests { | |||
| 1993 | mod when_branch_not_checked_out { | 2008 | mod when_branch_not_checked_out { |
| 1994 | use super::*; | 2009 | use super::*; |
| 1995 | 2010 | ||
| 1996 | #[test] | 2011 | #[tokio::test] |
| 1997 | fn branch_tip_is_most_recent_patch() -> Result<()> { | 2012 | async fn branch_tip_is_most_recent_patch() -> Result<()> { |
| 1998 | let (original_repo, _, mut patch_events) = generate_test_repo_and_events()?; | 2013 | let (original_repo, _, mut patch_events) = |
| 2014 | generate_test_repo_and_events().await?; | ||
| 1999 | let test_repo = GitTestRepo::default(); | 2015 | let test_repo = GitTestRepo::default(); |
| 2000 | test_repo.populate()?; | 2016 | test_repo.populate()?; |
| 2001 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2017 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -2010,9 +2026,9 @@ mod tests { | |||
| 2010 | Ok(()) | 2026 | Ok(()) |
| 2011 | } | 2027 | } |
| 2012 | 2028 | ||
| 2013 | #[test] | 2029 | #[tokio::test] |
| 2014 | fn branch_checked_out() -> Result<()> { | 2030 | async fn branch_checked_out() -> Result<()> { |
| 2015 | let (_, _, mut patch_events) = generate_test_repo_and_events()?; | 2031 | let (_, _, mut patch_events) = generate_test_repo_and_events().await?; |
| 2016 | let test_repo = GitTestRepo::default(); | 2032 | let test_repo = GitTestRepo::default(); |
| 2017 | test_repo.populate()?; | 2033 | test_repo.populate()?; |
| 2018 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2034 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -2027,9 +2043,9 @@ mod tests { | |||
| 2027 | Ok(()) | 2043 | Ok(()) |
| 2028 | } | 2044 | } |
| 2029 | 2045 | ||
| 2030 | #[test] | 2046 | #[tokio::test] |
| 2031 | fn returns_all_patches_applied() -> Result<()> { | 2047 | async fn returns_all_patches_applied() -> Result<()> { |
| 2032 | let (_, _, mut patch_events) = generate_test_repo_and_events()?; | 2048 | let (_, _, mut patch_events) = generate_test_repo_and_events().await?; |
| 2033 | let test_repo = GitTestRepo::default(); | 2049 | let test_repo = GitTestRepo::default(); |
| 2034 | test_repo.populate()?; | 2050 | test_repo.populate()?; |
| 2035 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2051 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -2048,9 +2064,9 @@ mod tests { | |||
| 2048 | mod when_branch_already_checked_out { | 2064 | mod when_branch_already_checked_out { |
| 2049 | use super::*; | 2065 | use super::*; |
| 2050 | 2066 | ||
| 2051 | #[test] | 2067 | #[tokio::test] |
| 2052 | fn returns_all_patches_applied_0() -> Result<()> { | 2068 | async fn returns_all_patches_applied_0() -> Result<()> { |
| 2053 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 2069 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 2054 | let test_repo = GitTestRepo::default(); | 2070 | let test_repo = GitTestRepo::default(); |
| 2055 | test_repo.populate()?; | 2071 | test_repo.populate()?; |
| 2056 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2072 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -2063,9 +2079,9 @@ mod tests { | |||
| 2063 | mod when_branch_not_checked_out { | 2079 | mod when_branch_not_checked_out { |
| 2064 | use super::*; | 2080 | use super::*; |
| 2065 | 2081 | ||
| 2066 | #[test] | 2082 | #[tokio::test] |
| 2067 | fn branch_checked_out() -> Result<()> { | 2083 | async fn branch_checked_out() -> Result<()> { |
| 2068 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 2084 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 2069 | let test_repo = GitTestRepo::default(); | 2085 | let test_repo = GitTestRepo::default(); |
| 2070 | test_repo.populate()?; | 2086 | test_repo.populate()?; |
| 2071 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2087 | let git_repo = Repo::from_path(&test_repo.dir)?; |
| @@ -2080,9 +2096,9 @@ mod tests { | |||
| 2080 | Ok(()) | 2096 | Ok(()) |
| 2081 | } | 2097 | } |
| 2082 | 2098 | ||
| 2083 | #[test] | 2099 | #[tokio::test] |
| 2084 | fn returns_all_patches_applied_0() -> Result<()> { | 2100 | async fn returns_all_patches_applied_0() -> Result<()> { |
| 2085 | let (_, _, patch_events) = generate_test_repo_and_events()?; | 2101 | let (_, _, patch_events) = generate_test_repo_and_events().await?; |
| 2086 | let test_repo = GitTestRepo::default(); | 2102 | let test_repo = GitTestRepo::default(); |
| 2087 | test_repo.populate()?; | 2103 | test_repo.populate()?; |
| 2088 | let git_repo = Repo::from_path(&test_repo.dir)?; | 2104 | let git_repo = Repo::from_path(&test_repo.dir)?; |