Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

JGit/User Guide

< JGit
Revision as of 17:43, 24 March 2010 by Unnamed Poltroon (Talk) (New page: ==How do I know if a file is under version control?== <source lang="java"> private boolean isVersionControlled(IResource resource) { RepositoryMapping mapping = RepositoryMapping.getMapp...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How do I know if a file is under version control?

private boolean isVersionControlled(IResource resource) {
  RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
  Repository repository = mapping.getRepository();
  String gitPath = mapping.getRepoRelativePath(resource);
  DirCache cache = DirCache.read(repository);
  return cache.getEntry(gitPath) != null;
}

Back to the top