private static IEnumerable <Commit> GetIntermediateCommits(IRepository repo, GitObject baseCommit, Commit headCommit)
        {
            if (baseCommit == null)
            {
                yield break;
            }

            var commitCache = intermediateCommitCache;

            if (commitCache == null || commitCache.LastOrDefault() != headCommit)
            {
                commitCache             = GetCommitsReacheableFromHead(repo, headCommit);
                intermediateCommitCache = commitCache;
            }

            var found = false;

            foreach (var commit in commitCache)
            {
                if (found)
                {
                    yield return(commit);
                }

                if (commit.Sha == baseCommit.Sha)
                {
                    found = true;
                }
            }
        }
示例#2
0
 public void RevParse(string revision, out Reference reference, out GitObject obj)
 {
     repositoryInstance.RevParse(revision, out reference, out obj);
 }
 public List <Branch> GetBranchesForCommit(GitObject commit)
 {
     return(repository.Branches.Where(b => !b.IsRemote && b.Tip == commit).ToList());
 }