| Copyright | (c) 2020-2021 Vaclav Svejcar |
|---|---|
| License | BSD-3-Clause |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.VCS.Ignore.Repo.Git
Description
This module contains implementation of Repo type class for the GIT content
versioning system. Most of the public functions is exported only to make them
visible for tests, end user of this library really shouldn't need to use them.
Synopsis
- data Git = Git {
- gitRepoRoot :: FilePath
- gitPatterns :: [(FilePath, [Pattern])]
- data Pattern = Pattern {}
- compilePattern :: Text -> Pattern
- matchesPattern :: Pattern -> FilePath -> Bool
- parsePatterns :: Text -> [Pattern]
- loadPatterns :: MonadIO m => FilePath -> m [Pattern]
- findGitIgnores :: MonadIO m => FilePath -> m [FilePath]
- gitIgnorePatterns :: MonadIO m => FilePath -> m [(FilePath, [Pattern])]
- repoPatterns :: MonadIO m => FilePath -> m [Pattern]
- globalPatterns :: MonadIO m => m [Pattern]
- scanRepo' :: (MonadIO m, MonadThrow m) => m [Pattern] -> (FilePath -> m [Pattern]) -> (FilePath -> m [(FilePath, [Pattern])]) -> (FilePath -> m Bool) -> FilePath -> m Git
- isIgnored' :: MonadIO m => Git -> FilePath -> m Bool
- isGitRepo :: MonadIO m => FilePath -> m Bool
Documentation
Data type representing scanned instance of GIT repository.
Constructors
| Git | |
Fields
| |
Represents single pattern to be used as a rule for ignoring paths.
Constructors
| Pattern | |
Compiles pattern.
Tests whether given path matches against the pattern.
Parses Glob patterns from given text source. Each line in input text is
considered to be single pattern. Lines starting with # (comments) and blank
lines are skipped.
>>>parsePatterns "*.xml\n.DS_Store"[Pattern {pPatterns = [compile "*.xml",compile "*.xml/*"], pRaw = "*.xml", pIsNegated = False},Pattern {pPatterns = [compile "**/.DS_Store",compile "**/.DS_Store/*"], pRaw = ".DS_Store", pIsNegated = False}]
Loads Glob patterns from given text file. If the fille cannot be read for
any reason, empty list is returned. See parsePatterns for more details
about parsing.
Arguments
| :: MonadIO m | |
| => FilePath | path to the directory to search in |
| -> m [FilePath] | paths of found |
Recursively finds all .gitignore files within the given directory path.
Arguments
| :: MonadIO m | |
| => FilePath | path to the directory to search |
| -> m [(FilePath, [Pattern])] | list of |
Recursively finds all .gitignore files within the given directory path
and parses them into Glob patterns. See loadPatterns and findGitIgnores
for more details.
Loads GIT repository specific ignore patterns, present in
REPO_ROOT/info/exclude file.
Loads global GIT ignore patterns, present in
XDG_CONFIG_GOME/git/ignore file.
Arguments
| :: (MonadIO m, MonadThrow m) | |
| => m [Pattern] | reference to |
| -> (FilePath -> m [Pattern]) | reference to |
| -> (FilePath -> m [(FilePath, [Pattern])]) | reference to |
| -> (FilePath -> m Bool) | reference to |
| -> FilePath | path to GIT repository root |
| -> m Git | scanned Git repository |
Internal version of scanRepo, where individual functions needs to be
explicitly provided, which is useful mainly for testing purposes.
Internal version of isIgnored function.