public static bool file_Delete(this API_NGit nGit, string virtualPath) { if (nGit.notNull()) { var fullPath = nGit.file_FullPath(virtualPath); if (fullPath.fileExists()) { fullPath.file_Delete(); return(true); } } return(false); }
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 List <string> commit_Files_FullPath(this RevCommit revCommit, API_NGit nGit) { return((from file in revCommit.commit_Files(nGit) select nGit.file_FullPath(file)).toList()); }
public static List <string> files_FullPath(this API_NGit nGit) { return((from file in nGit.files() select nGit.file_FullPath(file)).toList()); }