Examples of FS


Examples of org.eclipse.jgit.util.FS

    if (sock != null)
      return sock;

    final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;

    final FS fs = local == null ? FS.detect() : local.getFS();

    sock = sch
        .getSession(uri, getCredentialsProvider(), fs, tms);
    return sock;
  }
View Full Code Here

Examples of org.eclipse.jgit.util.FS

    if (workTree == null)
      // TODO: This should be handled by WorkingTreeIterators which
      // support write operations
      throw new UnsupportedOperationException();

    FS fs = db.getFS();
    File of = new File(workTree, tw.getPathString());
    File parentFolder = of.getParentFile();
    if (!fs.exists(parentFolder))
      parentFolder.mkdirs();
    FileOutputStream fos = new FileOutputStream(of);
    try {
      new MergeFormatter().formatMerge(fos, result,
          Arrays.asList(commitNames), CHARACTER_ENCODING);
View Full Code Here

Examples of org.eclipse.jgit.util.FS

    StoredConfig config = db.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();

    FS executableFs = new FS() {

      public boolean supportsExecute() {
        return true;
      }

      public boolean setExecute(File f, boolean canExec) {
        return true;
      }

      public ProcessBuilder runInShell(String cmd, String[] args) {
        return null;
      }

      public boolean retryFailedLockFileCommit() {
        return false;
      }

      public FS newInstance() {
        return this;
      }

      protected File discoverGitPrefix() {
        return null;
      }

      public boolean canExecute(File f) {
        return true;
      }

      @Override
      public boolean isCaseSensitive() {
        return true;
      }
    };

    Git git = Git.open(db.getDirectory(), executableFs);
    String path = "a.txt";
    writeTrashFile(path, "content");
    git.add().addFilepattern(path).call();
    RevCommit commit1 = git.commit().setMessage("commit").call();
    TreeWalk walk = TreeWalk.forPath(db, path, commit1.getTree());
    assertNotNull(walk);
    assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));

    FS nonExecutableFs = new FS() {

      public boolean supportsExecute() {
        return false;
      }
View Full Code Here

Examples of org.eclipse.jgit.util.FS

    // First commit - a.txt file
    git.add().addFilepattern("a.txt").call();
    git.commit().setMessage("commit1").setCommitter(committer).call();

    // pure mode change should be committable
    FS fs = db.getFS();
    fs.setExecute(file, true);
    git.add().addFilepattern("a.txt").call();
    git.commit().setMessage("mode change").setCommitter(committer).call();

    // pure mode change should be committable with -o option
    fs.setExecute(file, false);
    git.add().addFilepattern("a.txt").call();
    git.commit().setMessage("mode change").setCommitter(committer)
        .setOnly("a.txt").call();
  }
View Full Code Here

Examples of org.eclipse.jgit.util.FS

import org.junit.Test;

public class FileTreeIteratorJava7Test extends RepositoryTestCase {
  @Test
  public void testFileModeSymLinkIsNotATree() throws IOException {
    FS fs = db.getFS();
    // mål = target in swedish, just to get som unicode in here
    writeTrashFile("mål/data", "targetdata");
    fs.createSymLink(new File(trash, "länk"), "mål");
    FileTreeIterator fti = new FileTreeIterator(db);
    assertFalse(fti.eof());
    assertEquals("länk", fti.getEntryPathString());
    assertEquals(FileMode.SYMLINK, fti.getEntryFileMode());
    fti.next(1);
View Full Code Here

Examples of org.eclipse.jgit.util.FS

import org.junit.Test;

public class TreeWalkJava7Test extends RepositoryTestCase {
  @Test
  public void testSymlinkToDirNotRecursingViaSymlink() throws Exception {
    FS fs = db.getFS();
    assertTrue(fs.supportsSymlinks());
    writeTrashFile("target/data", "targetdata");
    fs.createSymLink(new File(trash, "link"), "target");
    TreeWalk tw = new TreeWalk(db);
    tw.setRecursive(true);
    tw.addTree(new FileTreeIterator(db));
    assertTrue(tw.next());
    assertEquals("link", tw.getPathString());
View Full Code Here

Examples of org.eclipse.jgit.util.FS

          r = new IgnoreNode();
      } else {
        r = new IgnoreNode();
      }

      FS fs = repository.getFS();
      String path = repository.getConfig().get(CoreConfig.KEY)
          .getExcludesFile();
      if (path != null) {
        File excludesfile;
        if (path.startsWith("~/")) //$NON-NLS-1$
          excludesfile = fs.resolve(fs.userHome(), path.substring(2));
        else
          excludesfile = fs.resolve(null, path);
        loadRulesFromFile(r, excludesfile);
      }

      File exclude = fs.resolve(repository.getDirectory(),
          Constants.INFO_EXCLUDE);
      loadRulesFromFile(r, exclude);

      return r.getRules().isEmpty() ? null : r;
    }
View Full Code Here

Examples of org.eclipse.jgit.util.FS

   * @throws IOException
   * @throws InterruptedException
   */
  @Test
  public void testSymlinkAttributes() throws IOException, InterruptedException {
    FS fs = FS.DETECTED;
    File link = new File(trash, "ä");
    File target = new File(trash, "å");
    fs.createSymLink(link, "å");
    assertTrue(fs.exists(link));
    String targetName = fs.readSymLink(link);
    assertEquals("å", targetName);
    assertTrue(fs.lastModified(link) > 0);
    assertTrue(fs.exists(link));
    assertFalse(fs.canExecute(link));
    assertEquals(2, fs.length(link));
    assertFalse(fs.exists(target));
    assertFalse(fs.isFile(target));
    assertFalse(fs.isDirectory(target));
    assertFalse(fs.canExecute(target));

    RepositoryTestCase.fsTick(link);
    // Now create the link target
    FileUtils.createNewFile(target);
    assertTrue(fs.exists(link));
    assertTrue(fs.lastModified(link) > 0);
    assertTrue(fs.lastModified(target) > fs.lastModified(link));
    assertFalse(fs.canExecute(link));
    fs.setExecute(target, true);
    assertFalse(fs.canExecute(link));
    assertTrue(fs.canExecute(target));
  }
View Full Code Here

Examples of org.eclipse.jgit.util.FS

    try {
      ol.copyTo(channel);
    } finally {
      channel.close();
    }
    FS fs = repo.getFS();
    WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY);
    if (opt.isFileMode() && fs.supportsExecute()) {
      if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) {
        if (!fs.canExecute(tmpFile))
          fs.setExecute(tmpFile, true);
      } else {
        if (fs.canExecute(tmpFile))
          fs.setExecute(tmpFile, false);
      }
    }
    if (!tmpFile.renameTo(f)) {
      // tried to rename which failed. Let' delete the target file and try
      // again
View Full Code Here

Examples of org.eclipse.jgit.util.FS

   *            directory to begin searching in.
   * @return {@code this} (for chaining calls).
   */
  public B findGitDir(File current) {
    if (getGitDir() == null) {
      FS tryFS = safeFS();
      while (current != null) {
        File dir = new File(current, DOT_GIT);
        if (FileKey.isGitRepository(dir, tryFS)) {
          setGitDir(dir);
          break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.