Skip to content
Match .gitignore-style
Perl
Branch: master
Clone or download
vti Checking in changes prior to tagging of version 0.03.
Changelog diff is:

diff --git a/Changes b/Changes
index f06844c..64b3e5f 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@ Revision history for Perl extension Text-Gitignore

 {{$NEXT}}

+0.03 2020-01-14T17:37:54Z
+
+    - ack of trailing slash should not stop recursion by Eric A. Zarko
+
 0.02 2019-03-27T20:54:45Z

     - fix negated patterns starting with / by Flavio Poletti
Latest commit 9b6f77d Jan 14, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Text
t
.gitignore
.proverc
.travis.yml
Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
minil.toml

README.md

NAME

Text::Gitignore - Match .gitignore patterns

SYNOPSIS

use Text::Gitignore qw(match_gitignore build_gitignore_matcher);

my @matched_files = match_gitignore(['pattern1', 'pattern2/*'], @files);

# Precompile patterns
my $matcher = build_gitignore_matcher(['*.js']);

if ($matcher->('foo.js')) {

    # Matched
}

DESCRIPTION

Text::Gitignore matches .gitignore patterns. It combines Text::Glob and File::FnMatch functionality with several .gitignore-specific tweaks.

EXPORTED FUNCTIONS

match_gitignore

my @matched_files = match_gitignore(['pattern1', 'pattern2/*'], @files);

Returns matched paths (if any). Accepts a string (slurped file for example), or an array reference

build_gitignore_matcher

# Precompile patterns
my $matcher = build_gitignore_matcher(['*.js']);

if ($matcher->('foo.js')) {

    # Matched
}

Returns a code reference. The produced function accepts a single file as a first parameter and returns true when it was matched.

LICENSE

Originally developed for https://kritika.io.

Copyright (C) Viacheslav Tykhanovskyi.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

CREDITS

Flavio Poletti

Eric A. Zarko

AUTHOR

Viacheslav Tykhanovskyi viacheslav.t@gmail.com

You can’t perform that action at this time.