Package org.eclipse.jgit.util

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(), "info/exclude"); //$NON-NLS-1$
      loadRulesFromFile(r, exclude);

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


   * the listeners only when it differs.
   */
  private final AtomicInteger lastNotifiedModCnt = new AtomicInteger();

  RefDirectory(final FileRepository db) {
    final FS fs = db.getFS();
    parent = db;
    gitDir = db.getDirectory();
    logWriter = new ReflogWriter(db);
    refsDir = fs.resolve(gitDir, R_REFS);
    packedRefsFile = fs.resolve(gitDir, PACKED_REFS);

    looseRefs.set(RefList.<LooseRef> emptyList());
    packedRefs.set(PackedRefList.NO_PACKED_REFS);
  }
View Full Code Here

   * @throws IOException
   */
  public void pack(List<String> refs) throws IOException {
    if (refs.size() == 0)
      return;
    FS fs = parent.getFS();

    // Lock the packed refs file and read the content
    LockFile lck = new LockFile(packedRefsFile, fs);
    if (!lck.lock())
      throw new IOException(MessageFormat.format(
View Full Code Here

          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

   *            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

   * @param forceWrite
   *            true to write to disk all entries logged, false to respect the
   *            repository's config and current log file status
   */
  public ReflogWriter(final Repository repository, final boolean forceWrite) {
    final FS fs = repository.getFS();
    parent = repository;
    File gitDir = repository.getDirectory();
    logsDir = fs.resolve(gitDir, LOGS);
    logsRefsDir = fs.resolve(gitDir, LOGS + '/' + R_REFS);
    this.forceWrite = forceWrite;
  }
View Full Code Here

    try {
      ol.copyTo(channel);
    } finally {
      channel.close();
    }
    FS fs = repo.getFS();
    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);
      }
    }
    try {
      FileUtils.rename(tmpFile, f);
    } catch (IOException e) {
View Full Code Here

   * the listeners only when it differs.
   */
  private final AtomicInteger lastNotifiedModCnt = new AtomicInteger();

  RefDirectory(final FileRepository db) {
    final FS fs = db.getFS();
    parent = db;
    gitDir = db.getDirectory();
    logWriter = new ReflogWriter(db);
    refsDir = fs.resolve(gitDir, R_REFS);
    packedRefsFile = fs.resolve(gitDir, PACKED_REFS);

    looseRefs.set(RefList.<LooseRef> emptyList());
    packedRefs.set(PackedRefList.NO_PACKED_REFS);
  }
View Full Code Here

   * @throws IOException
   */
  public void pack(List<String> refs) throws IOException {
    if (refs.size() == 0)
      return;
    FS fs = parent.getFS();

    // Lock the packed refs file and read the content
    LockFile lck = new LockFile(packedRefsFile, fs);
    if (!lck.lock())
      throw new IOException(MessageFormat.format(
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.util.FS

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.