public virtual void MultipleStashedCommits() { Git git = Git.Wrap(db); WriteTrashFile("file.txt", "content"); git.Add().AddFilepattern("file.txt").Call(); RevCommit commit1 = git.Commit().SetMessage("create file").Call(); WriteTrashFile("file.txt", "content2"); git.Add().AddFilepattern("file.txt").Call(); RevCommit commit2 = git.Commit().SetMessage("edit file").Call(); RefUpdate create = db.UpdateRef(Constants.R_STASH); create.SetNewObjectId(commit1); NUnit.Framework.Assert.AreEqual(RefUpdate.Result.NEW, create.Update()); RefUpdate update = db.UpdateRef(Constants.R_STASH); update.SetNewObjectId(commit2); NUnit.Framework.Assert.AreEqual(RefUpdate.Result.FAST_FORWARD, update.Update()); StashListCommand command = git.StashList(); ICollection <RevCommit> stashed = command.Call(); NUnit.Framework.Assert.IsNotNull(stashed); NUnit.Framework.Assert.AreEqual(2, stashed.Count); Iterator <RevCommit> iter = stashed.Iterator(); NUnit.Framework.Assert.AreEqual(commit2, iter.Next()); NUnit.Framework.Assert.AreEqual(commit1, iter.Next()); }
public virtual void NoStashRef() { StashListCommand command = Git.Wrap(db).StashList(); ICollection <RevCommit> stashed = command.Call(); NUnit.Framework.Assert.IsNotNull(stashed); NUnit.Framework.Assert.IsTrue(stashed.IsEmpty()); }
public virtual void SingleStashedCommit() { Git git = Git.Wrap(db); WriteTrashFile("file.txt", "content"); git.Add().AddFilepattern("file.txt").Call(); RevCommit commit = git.Commit().SetMessage("create file").Call(); RefUpdate update = db.UpdateRef(Constants.R_STASH); update.SetNewObjectId(commit); NUnit.Framework.Assert.AreEqual(RefUpdate.Result.NEW, update.Update()); StashListCommand command = git.StashList(); ICollection <RevCommit> stashed = command.Call(); NUnit.Framework.Assert.IsNotNull(stashed); NUnit.Framework.Assert.AreEqual(1, stashed.Count); NUnit.Framework.Assert.AreEqual(commit, stashed.Iterator().Next()); }