tests/TestTreeFilteringScripts.cs
/// <summary>
/// Deletes all binary files bigger than 10 bytes
/// </summary>
Deletes all binary files bigger than 10 bytes
Deletes all binary files bigger than 10 bytes
[Fact]
        public void RemoveBinaryFilesBiggerThan10Bytes()
        {
            var test = InitializeTest();
            Assert.Equal(0, Program.Main("--remove", "* => entry.Discard = entry.IsBinary && entry.Size > 10; ",
                "--repo-dir", test.Path,
                "--branch", NewBranch,
                @"HEAD"));
            var repo = test.Repo;
            var headNewMaster = AssertBranchRef(repo);
            var originalCommits = GetCommits(repo);
            var newCommits = GetCommits(repo, headNewMaster);
            Assert.Equal(originalCommits.Count -1, newCommits.Count);
            foreach (var commit in newCommits)
            {
                var entries = GetEntries(commit.Tree).ToList();
                foreach (var entry in entries)
                {
                    var blob = (Blob)entry.Target;
                    Assert.False(blob.IsBinary);
                }
            }
            test.Dispose();
        }
[ Fact ] public void RemoveBinaryFilesBiggerThan10Bytes ( ) { var test = InitializeTest ( ) ; Assert . Equal ( 0 , Program . Main ( " " , " " , " " , test . Path , " " , NewBranch , @"HEAD" ) ) ; var repo = test . Repo ; var headNewMaster = AssertBranchRef ( repo ) ; var originalCommits = GetCommits ( repo ) ; var newCommits = GetCommits ( repo , headNewMaster ) ; Assert . Equal ( originalCommits . Count - 1 , newCommits . Count ) ; foreach ( var commit in newCommits ) { var entries = GetEntries ( commit . Tree ) . ToList ( ) ; foreach ( var entry in entries ) { var blob = ( Blob ) entry . Target ; Assert . False ( blob . IsBinary ) ; } } test . Dispose ( ) ; }
Deletes all binary files bigger than 10 bytes
Deletes all binary files bigger than 10 bytes
// We have only a binary file in one commit, so we should have one commit less // Cleanup the test only if we succeed