Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Config$ConfigEnum


      DirCache index = DirCache.newInCore();
      DirCacheBuilder builder = index.builder();
      ObjectInserter inserter = repo.newObjectInserter();
      RevWalk rw = new RevWalk(repo);
      try {
        Config cfg = new Config();
        for (Project proj : bareProjects) {
          String name = proj.path;
          String nameUri = proj.name;
          cfg.setString("submodule", name, "path", name); //$NON-NLS-1$ //$NON-NLS-2$
          cfg.setString("submodule", name, "url", nameUri); //$NON-NLS-1$ //$NON-NLS-2$
          // create gitlink
          DirCacheEntry dcEntry = new DirCacheEntry(name);
          ObjectId objectId;
          if (ObjectId.isId(proj.revision))
            objectId = ObjectId.fromString(proj.revision);
          else {
            objectId = callback.sha1(nameUri, proj.revision);
          }
          if (objectId == null)
            throw new RemoteUnavailableException(nameUri);
          dcEntry.setObjectId(objectId);
          dcEntry.setFileMode(FileMode.GITLINK);
          builder.add(dcEntry);

          for (CopyFile copyfile : proj.copyfiles) {
            byte[] src = callback.readFile(
                nameUri, proj.revision, copyfile.src);
            objectId = inserter.insert(Constants.OBJ_BLOB, src);
            dcEntry = new DirCacheEntry(copyfile.dest);
            dcEntry.setObjectId(objectId);
            dcEntry.setFileMode(FileMode.REGULAR_FILE);
            builder.add(dcEntry);
          }
        }
        String content = cfg.toText();

        // create a new DirCacheEntry for .gitmodules file.
        final DirCacheEntry dcEntry = new DirCacheEntry(Constants.DOT_GIT_MODULES);
        ObjectId objectId = inserter.insert(Constants.OBJ_BLOB,
            content.getBytes(Constants.CHARACTER_ENCODING));
View Full Code Here


  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    final Config config = db.getConfig();
    remoteConfig = new RemoteConfig(config, "test");
    remoteConfig.addURI(new URIish("http://everyones.loves.git/u/2"));
    transport = null;
  }
View Full Code Here

  public void indexWithGitmodules() throws Exception {
    final ObjectId subId = ObjectId
        .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
    final String path = "sub";

    final Config gitmodules = new Config();
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_PATH,
        "sub");
    // Different config in the index should be overridden by the working tree.
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/bad");
    final RevBlob gitmodulesBlob = testDb.blob(gitmodules.toText());

    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/sub");
    writeTrashFile(DOT_GIT_MODULES, gitmodules.toText());

    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  public void treeIdWithGitmodules() throws Exception {
    final ObjectId subId = ObjectId
        .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
    final String path = "sub";

    final Config gitmodules = new Config();
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_PATH,
        "sub");
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/sub");

    RevCommit commit = testDb.getRevWalk().parseCommit(testDb.commit()
        .noParents()
        .add(DOT_GIT_MODULES, gitmodules.toText())
        .edit(new PathEdit(path) {

              public void apply(DirCacheEntry ent) {
                ent.setFileMode(FileMode.GITLINK);
                ent.setObjectId(subId);
View Full Code Here

  public void testTreeIteratorWithGitmodules() throws Exception {
    final ObjectId subId = ObjectId
        .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
    final String path = "sub";

    final Config gitmodules = new Config();
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_PATH,
        "sub");
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/sub");

    RevCommit commit = testDb.getRevWalk().parseCommit(testDb.commit()
        .noParents()
        .add(DOT_GIT_MODULES, gitmodules.toText())
        .edit(new PathEdit(path) {

              public void apply(DirCacheEntry ent) {
                ent.setFileMode(FileMode.GITLINK);
                ent.setObjectId(subId);
View Full Code Here

public class RemoteConfigTest {
  private Config config;

  @Before
  public void setUp() throws Exception {
    config = new Config();
  }
View Full Code Here

  public void setUp() throws Exception {
    config = new Config();
  }

  private void readConfig(final String dat) throws ConfigInvalidException {
    config = new Config();
    config.fromText(dat);
  }
View Full Code Here

              modulesConfig = new BlobBasedConfig(null, repository,
                  configWalk.getObjectId(0));
              return this;
            }
          }
          modulesConfig = new Config();
        } finally {
          if (idx > 0)
            rootTree.next(idx);
        }
      } finally {
View Full Code Here

    diffCollector = new DiffCollector();
  }

  protected FollowFilter follow(final String followPath) {
    FollowFilter followFilter =
      FollowFilter.create(followPath, new Config().get(DiffConfig.KEY));
    followFilter.setRenameCallback(diffCollector);
    rw.setTreeFilter(followFilter);
    return followFilter;
  }
View Full Code Here

            "Missing commit message.", null));
      }

      Git git = new Git(db);
      CommitCommand cc = git.commit();
      Config config = git.getRepository().getConfig();

      boolean amend = Boolean.parseBoolean(requestObject.optString(GitConstants.KEY_COMMIT_AMEND, null));
      boolean insertChangeId = config.getBoolean(ConfigConstants.CONFIG_GERRIT_SECTION, ConfigConstants.CONFIG_KEY_CREATECHANGEID, false)
          || Boolean.parseBoolean(requestObject.optString(GitConstants.KEY_CHANGE_ID, null));

      String committerName = requestObject.optString(GitConstants.KEY_COMMITTER_NAME, null);
      String committerEmail = requestObject.optString(GitConstants.KEY_COMMITTER_EMAIL, null);
      String authorName = requestObject.optString(GitConstants.KEY_AUTHOR_NAME, null);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.Config$ConfigEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.