These files are from rsync.git commit
f92f5b166e3019db42bc7fe1aa2f1a9178cd215d, which was the last commit
before rsync turned GPL-3. All files are imported as-is and
no-op. Adaptation is done in a separate patch.
rsync.git -> git.git
lib/wildmatch.[ch] wildmatch.[ch]
wildtest.c test-wildmatch.c
wildtest.txtt/t3070/wildtest.txt
Signed-off-by: Nguyễn Thái Ngọc Duy
Signed-off-by: Junio C Hamano
---
t/t3070/wildtest.txt | 165 +++
test-wildmatch.c | 222 +++
wildmatch.c | 368 +++
wildmatch.h | 6 +
4 files changed, 761 insertions(+)
create mode 100644 t/t3070/wildtest.txt
create mode 100644 test-wildmatch.c
create mode 100644 wildmatch.c
create mode 100644 wildmatch.h
diff --git a/t/t3070/wildtest.txt b/t/t3070/wildtest.txt
new file mode 100644
index 000..42c1678
--- /dev/null
+++ b/t/t3070/wildtest.txt
@@ -0,0 +1,165 @@
+# Input is in the following format (all items white-space separated):
+#
+# The first two items are 1 or 0 indicating if the wildmat call is expected to
+# succeed and if fnmatch works the same way as wildmat, respectively. After
+# that is a text string for the match, and a pattern string. Strings can be
+# quoted (if desired) in either double or single quotes, as well as backticks.
+#
+# MATCH FNMATCH_SAME "text to match" 'pattern to use'
+
+# Basic wildmat features
+1 1 foofoo
+0 1 foobar
+1 1 '' ""
+1 1 foo???
+0 1 foo??
+1 1 foo*
+1 1 foof*
+0 1 foo*f
+1 1 foo*foo*
+1 1 foobar *ob*a*r*
+1 1 aaabababab *ab
+1 1 foo* foo\*
+0 1 foobar foo\*bar
+1 1 f\oo f\\oo
+1 1 ball *[al]?
+0 1 ten[ten]
+1 1 ten**[!te]
+0 1 ten**[!ten]
+1 1 tent[a-g]n
+0 1 tent[!a-g]n
+1 1 tont[!a-g]n
+1 1 tont[^a-g]n
+1 1 a]ba[]]b
+1 1 a-ba[]-]b
+1 1 a]ba[]-]b
+0 1 aaba[]-]b
+1 1 aaba[]a-]b
+1 1 ] ]
+
+# Extended slash-matching features
+0 1 foo/baz/barfoo*bar
+1 1 foo/baz/barfoo**bar
+0 1 foo/barfoo?bar
+0 1 foo/barfoo[/]bar
+0 1 foo/barf[^eiu][^eiu][^eiu][^eiu][^eiu]r
+1 1 foo-barf[^eiu][^eiu][^eiu][^eiu][^eiu]r
+0 1 foo**/foo
+1 1 /foo **/foo
+1 1 bar/baz/foo**/foo
+0 1 bar/baz/foo*/foo
+0 0 foo/bar/baz**/bar*
+1 1 deep/foo/bar/baz **/bar/*
+0 1 deep/foo/bar/baz/ **/bar/*
+1 1 deep/foo/bar/baz/ **/bar/**
+0 1 deep/foo/bar **/bar/*
+1 1 deep/foo/bar/ **/bar/**
+1 1 foo/bar/baz**/bar**
+1 1 foo/bar/baz/x */bar/**
+0 0 deep/foo/bar/baz/x */bar/**
+1 1 deep/foo/bar/baz/x **/bar/*/*
+
+# Various additional tests
+0 1 acrt a[c-c]st
+1 1 acrt a[c-c]rt
+0 1 ] [!]-]
+1 1 a [!]-]
+0 1 '' \
+0 1 \ \
+0 1 /\ */\
+1 1 /\ */\\
+1 1 foofoo
+1 1 @foo @foo
+0 1 foo@foo
+1 1 [ab] \[ab]
+1 1 [ab] [[]ab]
+1 1 [ab] [[:]ab]
+0 1 [ab] [[::]ab]
+1 1 [ab] [[:digit]ab]
+1 1 [ab] [\[:]ab]
+1 1 ?a?b \??\?b
+1 1 abc\a\b\c
+0 1 foo''
+1 1 foo/bar/baz/to **/t[o]
+
+# Character class tests
+1 1 a1B[[:alpha:]][[:digit:]][[:upper:]]
+0 1 a [[:digit:][:upper:][:space:]]
+1 1 A [[:digit:][:upper:][:space:]]
+1 1 1 [[:digit:][:upper:][:space:]]
+0 1 1 [[:digit:][:upper:][:spaci:]]
+1 1 ' '[[:digit:][:upper:][:space:]]
+0 1 . [[:digit:][:upper:][:space:]]
+1 1 . [[:digit:][:punct:][:space:]]
+1 1 5 [[:xdigit:]]
+1 1 f [[:xdigit:]]
+1 1 D [[:xdigit:]]
+1 1 _
[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
+#1 1 �
[^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
+1 1
[^[:alnum:][:alpha:][:blank:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:xdigit:]]
+1 1 .
[^[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:lower:][:space:][:upper:][:xdigit:]]
+1 1 5 [a-c[:digit:]x-z]
+1 1