Class GitIgnore

java.lang.Object
nl.basjes.gitignore.GitIgnore

public class GitIgnore extends Object
A class that holds a single .gitignore file
  • Constructor Details

    • GitIgnore

      public GitIgnore(File file) throws IOException
      Throws:
      IOException
    • GitIgnore

      public GitIgnore(String projectRelativeBaseDir, File file) throws IOException
      Throws:
      IOException
    • GitIgnore

      public GitIgnore(String gitIgnoreContent)
    • GitIgnore

      public GitIgnore(String gitIgnoreContent, boolean verbose)
    • GitIgnore

      public GitIgnore(String projectRelativeBaseDir, String gitIgnoreContent)
    • GitIgnore

      public GitIgnore(String projectRelativeBaseDir, String gitIgnoreContent, boolean verbose)
  • Method Details

    • isIgnoredFile

      public Boolean isIgnoredFile(String filename)
      Checks if the file matches the stored expressions.
      Parameters:
      filename - The filename to be checked (which is a project relative filename).
      Returns:
      NULL: not matched, True: must be ignored, False: it must be UNignored
    • ignoreFile

      public boolean ignoreFile(String filename)
      Checks if the file matches the stored expressions. This is NOT suitable for combining multiple sets of rules!
      Parameters:
      filename - The filename to be checked (which is a project relative filename).
      Returns:
      true: must be ignored, false: it must be not be ignored
    • keepFile

      public boolean keepFile(String filename)
      Checks if the file matches the stored expressions. This is NOT suitable for combining multiple sets of rules!
      Parameters:
      filename - The filename to be checked (which is a project relative filename).
      Returns:
      true: must be kept, false: it must be ignored
    • setVerbose

      public void setVerbose(boolean verbose)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProjectRelativeBaseDir

      public String getProjectRelativeBaseDir()