public void Init_CreatesGitFiles()
        {
            using (var temp = new TempDir())
            {
                var git = new GitRepo(m_log, temp.Path);
                git.Init(Enumerable.Empty <GitConfigOption>());

                Assert.IsTrue(Directory.Exists(temp.GetPath("refs")));
                Assert.IsTrue(File.Exists(temp.GetPath("HEAD")));
            }
        }
		public void Init_CreatesGitFiles()
		{
			using (var temp = new TempDir())
			{
				var git = new GitRepo(m_log, temp.Path);
				git.Init(Enumerable.Empty<GitConfigOption>());

				Assert.IsTrue(Directory.Exists(temp.GetPath("refs")));
				Assert.IsTrue(File.Exists(temp.GetPath("HEAD")));
			}
		}
        public void Init_CreatesDirectoryIfItDoesNotExist()
        {
            using (var temp = new TempDir())
            {
                var gitdir = temp.GetPath(@"dir1\dir2");
                var git    = new GitRepo(m_log, gitdir);
                git.Init(Enumerable.Empty <GitConfigOption>());

                Assert.IsTrue(Directory.Exists(gitdir));
                Assert.IsTrue(Directory.Exists(temp.GetPath(@"dir1\dir2\refs")));
            }
        }
		public void Init_CreatesDirectoryIfItDoesNotExist()
		{
			using (var temp = new TempDir())
			{
				var gitdir = temp.GetPath(@"dir1\dir2");
				var git = new GitRepo(m_log, gitdir);
				git.Init(Enumerable.Empty<GitConfigOption>());

				Assert.IsTrue(Directory.Exists(gitdir));
				Assert.IsTrue(Directory.Exists(temp.GetPath(@"dir1\dir2\refs")));
			}
		}
        public void Init_Option_Set()
        {
            using (var temp = new TempDir())
            {
                var git = new GitRepo(m_log, temp.Path);
                git.Init(new[] { new GitConfigOption("foo.bar", "blah", add: false) });

                var configFile     = temp.GetPath("config");
                var configContents = File.ReadAllLines(configFile);

                var sectionLineNumber = FindSectionHeader(configContents, "foo");
                Assert.IsTrue(sectionLineNumber >= 0);

                Assert.IsTrue(Regex.IsMatch(configContents[sectionLineNumber + 1].Trim(), @"bar\s*=\s*blah"));
            }
        }
		public void Init_Option_Set()
		{
			using (var temp = new TempDir())
			{
				var git = new GitRepo(m_log, temp.Path);
				git.Init(new[] { new GitConfigOption("foo.bar", "blah", add: false) });

				var configFile = temp.GetPath("config");
				var configContents = File.ReadAllLines(configFile);

				var sectionLineNumber = FindSectionHeader(configContents, "foo");
				Assert.IsTrue(sectionLineNumber >= 0);

				Assert.IsTrue(Regex.IsMatch(configContents[sectionLineNumber + 1].Trim(), @"bar\s*=\s*blah"));
			}
		}