public virtual void TestMaxCountRevFilter0()
        {
            RevCommit a = Commit();
            RevCommit b = Commit(a);

            rw.Reset();
            rw.SetRevFilter(MaxCountRevFilter.Create(0));
            MarkStart(b);
            NUnit.Framework.Assert.IsNull(rw.Next());
        }
 /// <summary>
 /// Executes the
 /// <code>Log</code>
 /// command with all the options and parameters
 /// collected by the setter methods (e.g.
 /// <see cref="Add(NGit.AnyObjectId)">Add(NGit.AnyObjectId)</see>
 /// ,
 /// <see cref="Not(NGit.AnyObjectId)">Not(NGit.AnyObjectId)</see>
 /// , ..) of this class. Each instance of this class
 /// should only be used for one invocation of the command. Don't call this
 /// method twice on an instance.
 /// </summary>
 /// <returns>an iteration over RevCommits</returns>
 /// <exception cref="NGit.Api.Errors.NoHeadException">of the references ref cannot be resolved
 ///     </exception>
 /// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
 public override Iterable <RevCommit> Call()
 {
     CheckCallable();
     if (pathFilters.Count > 0)
     {
         walk.SetTreeFilter(AndTreeFilter.Create(PathFilterGroup.Create(pathFilters), TreeFilter
                                                 .ANY_DIFF));
     }
     if (skip > -1 && maxCount > -1)
     {
         walk.SetRevFilter(AndRevFilter.Create(SkipRevFilter.Create(skip), MaxCountRevFilter
                                               .Create(maxCount)));
     }
     else
     {
         if (skip > -1)
         {
             walk.SetRevFilter(SkipRevFilter.Create(skip));
         }
         else
         {
             if (maxCount > -1)
             {
                 walk.SetRevFilter(MaxCountRevFilter.Create(maxCount));
             }
         }
     }
     if (!startSpecified)
     {
         try
         {
             ObjectId headId = repo.Resolve(Constants.HEAD);
             if (headId == null)
             {
                 throw new NoHeadException(JGitText.Get().noHEADExistsAndNoExplicitStartingRevisionWasSpecified
                                           );
             }
             Add(headId);
         }
         catch (IOException e)
         {
             // all exceptions thrown by add() shouldn't occur and represent
             // severe low-level exception which are therefore wrapped
             throw new JGitInternalException(JGitText.Get().anExceptionOccurredWhileTryingToAddTheIdOfHEAD
                                             , e);
         }
     }
     SetCallable(false);
     return(walk);
 }
        public virtual void TestMaxCountRevFilter()
        {
            RevCommit a  = Commit();
            RevCommit b  = Commit(a);
            RevCommit c1 = Commit(b);
            RevCommit c2 = Commit(b);
            RevCommit d  = Commit(c1, c2);
            RevCommit e  = Commit(d);

            rw.Reset();
            rw.SetRevFilter(MaxCountRevFilter.Create(3));
            MarkStart(e);
            AssertCommit(e, rw.Next());
            AssertCommit(d, rw.Next());
            AssertCommit(c2, rw.Next());
            NUnit.Framework.Assert.IsNull(rw.Next());
            rw.Reset();
            rw.SetRevFilter(MaxCountRevFilter.Create(0));
            MarkStart(e);
            NUnit.Framework.Assert.IsNull(rw.Next());
        }