コード例 #1
0
ファイル: RemoteConfigTests.cs プロジェクト: gilran/GitSharp
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
ファイル: RemoteConfigTests.cs プロジェクト: gilran/GitSharp
        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");
        }
コード例 #4
0
        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");
        }
コード例 #5
0
ファイル: Clone.cs プロジェクト: drothmaler/GitSharp
 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();
 }
コード例 #6
0
 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");
 }
コード例 #7
0
        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");
        }
コード例 #8
0
        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");
        }