public void fetch() { var commits_BeforeFetch = nGit2.commits(); var head_BeforeFetch = nGit2.head(); //repoPath2.startProcess(); var fetchResult1 = nGit2.fetch(repoPath1, "master"); var commits_AfterFetch = nGit2.commits(); var head_AfterFetch = nGit2.head(); Assert.IsEmpty(commits_BeforeFetch); Assert.IsNotEmpty(commits_AfterFetch); Assert.IsNull(head_BeforeFetch); Assert.IsNotNull(head_AfterFetch); // I would expect this to be true Assert.IsNull(nGit2.Last_Exception); Assert.IsNotNull(nGit2.Last_FetchResult); Assert.IsTrue(fetchResult1); var filesInRepo1 = nGit1.files(); var filesInRepo2 = nGit2.files(); Assert.AreEqual(1, filesInRepo1.size()); Assert.AreEqual(1, filesInRepo2.size()); var fullPathInRepo1 = nGit1.file_FullPath(filesInRepo1.first()); var fullPathInRepo2 = nGit2.file_FullPath(filesInRepo2.first()); Assert.IsTrue(fullPathInRepo1.fileExists()); Assert.IsFalse(fullPathInRepo2.fileExists()); //test Error handling var fetchResult2 = nGit2.fetch(repoPath1, "master_", "master"); Assert.IsNotNull(nGit2.Last_Exception); Assert.IsNull(nGit2.Last_FetchResult); Assert.IsFalse(fetchResult2); Assert.AreEqual(nGit2.Last_Exception.Message, "Remote does not have refs/heads/master_ available for fetch."); var fetchResult3 = nGit2.fetch(); Assert.IsNotNull(nGit2.Last_Exception); Assert.IsNull(nGit2.Last_FetchResult); Assert.IsFalse(fetchResult2); Assert.AreEqual(nGit2.Last_Exception.Message, "Invalid remote: origin"); }
public static bool fetch(this API_NGit nGit) { return(nGit.fetch("origin", "master", "master")); }
public static bool fetch(this API_NGit nGit, string remote, string branch) { return(nGit.fetch(remote, branch, branch)); }