示例#1
0
        public void GivenNewRepository_WhenBare_ThenInitCreatesRefsDirectory()
        {
            Gitlet.Init(Bare());

            var refsPath = Files.CurrentPath.Combine("refs");

            Assert.That(Directory.Exists(refsPath), Is.True);
        }
示例#2
0
        public void GivenNewRepository_WhenNotBare_ThenInitCreatesRefsHeadsDirectory()
        {
            Gitlet.Init();

            var refsHeadsPath = Files.CurrentPath.Combine(".gitlet", "refs", "heads");

            Assert.That(Directory.Exists(refsHeadsPath), Is.True);
        }
示例#3
0
        public void GivenNewRepository_WhenNotBare_ThenInitCreatesObjectsDirectory()
        {
            Gitlet.Init();

            var objectsPath = Files.CurrentPath.Combine(".gitlet", "objects");

            Assert.That(Directory.Exists(objectsPath), Is.True);
        }
示例#4
0
        public void GivenNewRepository_WhenBare_ThenInitCreatesConfig()
        {
            Gitlet.Init(Bare());

            var config = Files.CurrentPath.Combine("config").ReadAllText();

            Assert.That(config, Is.EqualTo("[core]\n    bare = true\n"));
        }
示例#5
0
        public void GivenNewRepository_WhenBare_ThenInitCreatesHead()
        {
            Gitlet.Init(Bare());

            var head = Files.CurrentPath.Combine("HEAD").ReadAllText();

            Assert.That(head, Is.EqualTo("ref: refs/heads/master\n"));
        }
示例#6
0
        public void GivenExistingRepository_ThenInitThrowException()
        {
            Gitlet.Init();

            Assert.That(() => Gitlet.Init(), Throws.Exception.With.Message.EqualTo("unsupported"));
        }
示例#7
0
 public static void Init()
 {
     Gitlet.Init();
 }