Exemple #1
0
        public void Should_parse_correctly_log_without_tags_and_empty_file_list()
        {
            log = new GitLog(log_9.ToStream(), null, null);

            Assert.Equal(new string[] { }, log.Tags);
            Assert.Equal(new TouchedFile[] { }, log.TouchedFiles);
        }
Exemple #2
0
        public void Should_interpret_renamed_file_as_deleted_and_added()
        {
            log = new GitLog(log_2.ToStream(), null, null);

            Assert.Equal(
                new string[]
            {
                "/git-export.c",
                "/git-mktag.c",
                "/show-diff.c"
            },
                log.TouchedFiles
                .Where(x => x.Action == TouchedFileAction.REMOVED)
                .Select(x => x.Path));

            Assert.Equal(
                new string[]
            {
                "/diff-files.c",
                "/export.c",
                "/mktag.c"
            },
                log.TouchedFiles
                .Where(x => x.Action == TouchedFileAction.ADDED)
                .Select(x => x.Path));
        }
Exemple #3
0
        public void Should_get_no_tags_from_log_with_references_only()
        {
            log = new GitLog(log_8.ToStream(), null, null);

            Assert.NotNull(log.Tags);
            Assert.Empty(log.Tags);
        }
Exemple #4
0
        public void Should_not_identify_file_type()
        {
            log = new GitLog(log_1.ToStream(), null, null);

            log.TouchedFiles.Where(x => x.Type != TouchedFile.ContentType.UNKNOWN)
            .Should().BeEmpty();
        }
Exemple #5
0
        public void Should_parse_filename_with_special_symbols()
        {
            log = new GitLog(log_4.ToStream(), null, null);

            Assert.Single(
                log.TouchedFiles
                .Where(x => x.Path == "/tests/regressiontests/staticfiles_tests/apps/test/static/test/spec\\314\\247ial.txt"));
        }
Exemple #6
0
        public void Should_keep_source_path_for_renamed_path()
        {
            log = new GitLog(log_2.ToStream(), null, null);

            Assert.Equal(
                "/git-export.c",
                log.TouchedFiles
                .Single(x => x.Path == "/export.c")
                .SourcePath);
        }
Exemple #7
0
        public void Should_keep_information_about_parent_and_child_revisions()
        {
            var parents  = new string[] { "2", "3" };
            var children = new string[] { "20", "30" };

            log = new GitLog(log_1.ToStream(), parents, children);

            Assert.Equal(parents, log.ParentRevisions);
            Assert.Equal(children, log.ChildRevisions);
        }
Exemple #8
0
        public void Should_parse_general_data_about_revision()
        {
            log = new GitLog(log_1.ToStream(), null, null);

            Assert.Equal("4bb04f2190d526f8917663f0be62d8026e1ed100", log.Revision);
            Assert.Equal("Linus Torvalds", log.AuthorName);
            Assert.Equal("*****@*****.**", log.AuthorEmail);
            Assert.Equal(new DateTime(2005, 4, 11, 22, 47, 57), log.Date);
            Assert.Equal("Rename '.dircache' directory to '.git'", log.Message);
        }
Exemple #9
0
        public void Should_be_ready_for_spaces_in_paths_for_renamed_file()
        {
            log = new GitLog(log_10.ToStream(), null, null);

            log.TouchedFiles.Select(x => x.Path)
            .Should().BeEquivalentTo(
                new string[] { "/aaa bbb.txt", "/aaa bbb ccc.txt" });
            log.TouchedFiles.Select(x => x.SourcePath)
            .Should().BeEquivalentTo(
                new string[] { null, "/aaa bbb.txt" });
        }
Exemple #10
0
        public void Should_prefer_file_addition_or_removing_over_modification_in_merge_log()
        {
            log = new GitLog(log_6.ToStream(), null, null);

            Assert.Equal(3, log.TouchedFiles.Count());
            Assert.Equal(new string[] { "/file1", "/file2", "/file3" },
                         log.TouchedFiles.Select(x => x.Path));
            Assert.Equal(new TouchedFileAction[]
            {
                TouchedFileAction.MODIFIED,
                TouchedFileAction.ADDED,
                TouchedFileAction.REMOVED
            },
                         log.TouchedFiles.Select(x => x.Action));
        }
Exemple #11
0
        public void Should_parse_merge_log()
        {
            log = new GitLog(log_5.ToStream(), null, null);

            Assert.Equal(20, log.TouchedFiles.Count());
            Assert.Equal(20, log.TouchedFiles.Select(x => x.Path).Distinct().Count());
            var makefile = log.TouchedFiles.Where(x => x.Path == "/Makefile").Single();

            Assert.Equal(TouchedFileAction.MODIFIED, makefile.Action);
            var blob = log.TouchedFiles.Where(x => x.Path == "/blob.c").Single();

            Assert.Equal(TouchedFileAction.ADDED, blob.Action);
            var revtree = log.TouchedFiles.Where(x => x.Path == "/rev-tree.c").Single();

            Assert.Equal(TouchedFileAction.MODIFIED, revtree.Action);
        }
Exemple #12
0
        public void Should_keep_alphabetically_sorted_list_of_touched_paths()
        {
            log = new GitLog(log_1.ToStream(), null, null);

            Assert.Equal(
                new string[]
            {
                "/cache.h",
                "/init-db.c",
                "/read-cache.c",
                "/read-tree.c",
                "/README",
                "/update-cache.c"
            },
                log.TouchedFiles.Select(x => x.Path));
        }
Exemple #13
0
        public void Should_interpret_copied_file_as_added_and_keep_source_path()
        {
            log = new GitLog(log_3.ToStream(), null, null);

            Assert.Equal(2, log.TouchedFiles.Count());
            Assert.Equal(2, log.TouchedFiles
                         .Where(x => x.Action == TouchedFileAction.ADDED)
                         .Count());
            Assert.Equal("/django/views/comments/__init__.py",
                         log.TouchedFiles
                         .Single(x => x.Path == "/django/contrib/__init__.py")
                         .SourcePath);
            Assert.Equal("/django/views/comments/__init__.py",
                         log.TouchedFiles
                         .Single(x => x.Path == "/django/contrib/comments/__init__.py")
                         .SourcePath);
        }
Exemple #14
0
        public void Should_parse_empty_message()
        {
            log = new GitLog(log_12.ToStream(), null, null);

            Assert.Equal(string.Empty, log.Message);
        }
Exemple #15
0
        public void Should_parse_multiline_message()
        {
            log = new GitLog(log_11.ToStream(), null, null);

            Assert.Equal("Move " + Environment.NewLine + "efs to shared runtime", log.Message);
        }
Exemple #16
0
        public void Should_get_tags_from_log()
        {
            log = new GitLog(log_7.ToStream(), null, null);

            Assert.Equal(new string[] { "qwe", "ab,c", "0.99" }, log.Tags);
        }