示例#1
0
        public void FastwardMergeTest()
        {
            dataProvider.Setup(d => d.GetRef("HEAD", true)).Returns(RefValue.Create(false, "head-tree-oid"));
            commitOperation.Setup(c => c.GetCommit("head-tree-oid")).Returns(new Commit
            {
                Tree = "head-tree-oid",
            });

            commitOperation.Setup(c => c.GetCommit("other-oid")).Returns(new Commit
            {
                Tree = "other-tree-oid",
            });

            commitOperation.Setup(c => c.GetCommitHistory(It.IsAny <IEnumerable <string> >())).Returns <IEnumerable <string> >((oids) =>
            {
                if (oids.ToArray()[0] == "other-oid")
                {
                    return(new string[] { "other-oid", "head-tree-oid" });
                }
                if (oids.ToArray()[0] == "head-tree-oid")
                {
                    return(new string[] { "head-tree-oid" });
                }
                return(Array.Empty <string>());
            });

            this.treeOperation.Setup(t => t.ReadTree("other-tree-oid", true));
            this.dataProvider.Setup(d => d.UpdateRef("HEAD", It.Is <RefValue>(r => !r.Symbolic && r.Value == "other-oid"), true));
            mergeOperation.Merge("other-oid");
            dataProvider.VerifyAll();
            treeOperation.VerifyAll();
            commitOperation.VerifyAll();
        }
示例#2
0
文件: Program.cs 项目: gaufung/ugit
 private static void Merge(string commit)
 {
     commit = OidConverter(commit);
     MergeOperation.Merge(commit);
 }