Ejemplo n.º 1
0
        public void GivenNewRepository_WhenBare_ThenInitCreatesRefsDirectory()
        {
            Gitlet.Init(Bare());

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

            Assert.That(Directory.Exists(refsPath), Is.True);
        }
Ejemplo n.º 2
0
        public void GivenNewRepository_WhenNotBare_ThenInitCreatesRefsHeadsDirectory()
        {
            Gitlet.Init();

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

            Assert.That(Directory.Exists(refsHeadsPath), Is.True);
        }
Ejemplo n.º 3
0
        public void GivenNewRepository_WhenNotBare_ThenInitCreatesObjectsDirectory()
        {
            Gitlet.Init();

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

            Assert.That(Directory.Exists(objectsPath), Is.True);
        }
Ejemplo n.º 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"));
        }
Ejemplo 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"));
        }
Ejemplo n.º 6
0
        public void GivenExistingRepository_ThenInitThrowException()
        {
            Gitlet.Init();

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