This makes wildmatch.c part of libgit.a and builds test-wildmatch Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- .gitignore | 1 + Makefile | 6 ++++++ t/t3070-wildmatch.sh | 27 +++++++++++++++++++++++++++ test-wildmatch.c | 8 +++++++- wildmatch.c | 8 +++++++- 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100755 t/t3070-wildmatch.sh diff --git a/.gitignore b/.gitignore index 68fe464..54b1b3b 100644 --- a/.gitignore +++ b/.gitignore @@ -196,6 +196,7 @@ /test-sigchain /test-subprocess /test-svn-fe +/test-wildmatch /common-cmds.h *.tar.gz *.dsc diff --git a/Makefile b/Makefile index 56301dc..745e88c 100644 --- a/Makefile +++ b/Makefile @@ -511,6 +511,7 @@ TEST_PROGRAMS_NEED_X += test-sha1 TEST_PROGRAMS_NEED_X += test-sigchain TEST_PROGRAMS_NEED_X += test-subprocess TEST_PROGRAMS_NEED_X += test-svn-fe +TEST_PROGRAMS_NEED_X += test-wildmatch TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X)) @@ -683,6 +684,7 @@ LIB_H += userdiff.h LIB_H += utf8.h LIB_H += varint.h LIB_H += walker.h +LIB_H += wildmatch.h LIB_H += wt-status.h LIB_H += xdiff-interface.h LIB_H += xdiff/xdiff.h @@ -814,6 +816,7 @@ LIB_OBJS += utf8.o LIB_OBJS += varint.o LIB_OBJS += version.o LIB_OBJS += walker.o +LIB_OBJS += wildmatch.o LIB_OBJS += wrapper.o LIB_OBJS += write_or_die.o LIB_OBJS += ws.o @@ -2586,6 +2589,9 @@ test-svn-fe$X: vcs-svn/lib.a test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS) +test-wildmatch$X: test-wildmatch.o GIT-LDFLAGS + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) -lpopt + check-sha1:: test-sha1$X ./test-sha1.sh diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh new file mode 100755 index 0000000..7fb63ff --- /dev/null +++ b/t/t3070-wildmatch.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +test_description='wildmatch tests' + +. ./test-lib.sh + +test_wildmatch() { + test_expect_success "wildmatch $*" " + test-wildmatch $* ../t3070-wildmatch/wildtest.txt >actual && + echo 'No wildmatch errors found.' >expected && + test_cmp expected actual + " +} + +test_wildmatch -x1 +test_wildmatch -x1 -e1 +test_wildmatch -x1 -else +test_wildmatch -x2 +test_wildmatch -x2 -ese +test_wildmatch -x3 +test_wildmatch -x3 -e1 +test_wildmatch -x4 +test_wildmatch -x4 -e2e +test_wildmatch -x5 +test_wildmatch -x5 -es + +test_done diff --git a/test-wildmatch.c b/test-wildmatch.c index 88585c2..828188a 100644 --- a/test-wildmatch.c +++ b/test-wildmatch.c @@ -20,7 +20,13 @@ /*#define COMPARE_WITH_FNMATCH*/ #define WILD_TEST_ITERATIONS -#include "lib/wildmatch.c" +#include "wildmatch.c" + +#define MAXPATHLEN 1024 +#ifdef NO_STRLCPY +#include "compat/strlcpy.c" +#define strlcpy gitstrlcpy +#endif #include <popt.h> diff --git a/wildmatch.c b/wildmatch.c index c7f7f9f..625cb0c 100644 --- a/wildmatch.c +++ b/wildmatch.c @@ -9,7 +9,13 @@ ** work differently than '*', and to fix the character-class code. */ -#include "rsync.h" +#include <stddef.h> +#include <ctype.h> +#include <string.h> + +#include "wildmatch.h" + +typedef unsigned char uchar; /* What character marks an inverted character class? */ #define NEGATE_CLASS '!' -- 1.7.12.403.gce5cf6f.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html