public void test017_SaveAllTags() { RemoteConfig rc = new RemoteConfig(db.Config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.FETCH_TAGS); rc.Update(db.Config); db.Config.Save(); checkFile(new FileInfo(Path.Combine(db.Directory.ToString(), "config")), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --tags\n"); }
public void test016_SaveNoTags() { RemoteConfig rc = new RemoteConfig(db.Config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.NO_TAGS); rc.Update(db.Config); db.Config.save(); checkFile(db.Config.getFile(), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --no-tags\n"); }
public void test015_SaveRemoveFirstURI() { writeConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" + "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n"); RemoteConfig rc = new RemoteConfig(db.Config, "spearce"); Assert.AreEqual(2, rc.URIs.Count); rc.RemoveURI(new URIish("http://www.spearce.org/egit.git")); Assert.AreEqual(1, rc.URIs.Count); rc.Update(db.Config); db.Config.Save(); checkFile(new FileInfo(Path.Combine(db.Directory.ToString(), "config")), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"spearce\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"); }
public void test014_SaveRemoveLastURI() { writeConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" + "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n"); RemoteConfig rc = new RemoteConfig(db.Config, "spearce"); Assert.AreEqual(2, rc.URIs.Count); rc.RemoveURI(new URIish("/some/dir")); Assert.AreEqual(1, rc.URIs.Count); rc.Update(db.Config); db.Config.save(); checkFile(db.Config.getFile(), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"spearce\"]\n" + "\turl = http://www.spearce.org/egit.git\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"); }
private void saveRemote(URIish uri) { RemoteConfig rc = new RemoteConfig(db.Config, remoteName); rc.AddURI(uri); rc.AddFetchRefSpec(new RefSpec().SetForce(true).SetSourceDestination(Constants.R_HEADS + "*", Constants.R_REMOTES + remoteName + "/*")); rc.Update(db.Config); db.Config.save(); }
public void testSaveTimeout() { RemoteConfig rc = new RemoteConfig(config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.Timeout = 60; rc.Update(config); checkConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttimeout = 60\n"); }
public void testSaveRemoveLastURI() { readConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" + "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n"); RemoteConfig rc = new RemoteConfig(config, "spearce"); Assert.AreEqual(2, rc.URIs.Count); rc.RemoveURI(new URIish("/some/dir")); Assert.AreEqual(1, rc.URIs.Count); rc.Update(config); checkConfig("[remote \"spearce\"]\n" + "\turl = http://www.spearce.org/egit.git\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"); }
public void testSaveNoTags() { RemoteConfig rc = new RemoteConfig(config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.NO_TAGS); rc.Update(config); checkConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --no-tags\n"); }