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

Difference between revisions of "JGit/User Guide"

(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...)
 
(Removing all content from page)
Line 1: Line 1:
==How do I know if a file is under version control?==
+
 
<source lang="java">
+
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;
+
}
+
</source>
+

Revision as of 17:44, 24 March 2010

Back to the top