git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 4/5] Integrate wildmatch to git
Date: Sat, 15 Sep 2012 19:02:03 +0700	[thread overview]
Message-ID: <1347710524-15404-5-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1347710524-15404-1-git-send-email-pclouds@gmail.com>

This makes wildmatch.c part of libgit.a and builds test-wildmatch

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile             |  6 ++++++
 compat/wildmatch.c   |  8 +++++++-
 t/t3070-wildmatch.sh | 27 +++++++++++++++++++++++++++
 test-wildmatch.c     |  8 +++++++-
 4 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100755 t/t3070-wildmatch.sh

diff --git a/Makefile b/Makefile
index 56301dc..c3608e6 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))
 
@@ -605,6 +606,7 @@ LIB_H += compat/mingw.h
 LIB_H += compat/obstack.h
 LIB_H += compat/precompose_utf8.h
 LIB_H += compat/terminal.h
+LIB_H += compat/wildmatch.h
 LIB_H += compat/win32/dirent.h
 LIB_H += compat/win32/poll.h
 LIB_H += compat/win32/pthread.h
@@ -709,6 +711,7 @@ LIB_OBJS += combine-diff.o
 LIB_OBJS += commit.o
 LIB_OBJS += compat/obstack.o
 LIB_OBJS += compat/terminal.o
+LIB_OBJS += compat/wildmatch.o
 LIB_OBJS += config.o
 LIB_OBJS += connect.o
 LIB_OBJS += connected.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/compat/wildmatch.c b/compat/wildmatch.c
index c7f7f9f..625cb0c 100644
--- a/compat/wildmatch.c
+++ b/compat/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	'!'
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..2c506a0 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 "compat/wildmatch.c"
+
+#define MAXPATHLEN 1024
+#ifdef NO_STRLCPY
+#include "compat/strlcpy.c"
+#define strlcpy gitstrlcpy
+#endif
 
 #include <popt.h>
 
-- 
1.7.12.403.gce5cf6f.dirty

  parent reply	other threads:[~2012-09-15 12:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15 12:01 [PATCH 0/5] Support matching "**" in .gitattributes and .gitignore Nguyễn Thái Ngọc Duy
2012-09-15 12:02 ` [PATCH 1/5] Import wildmatch from rsync Nguyễn Thái Ngọc Duy
2012-09-16  6:49   ` Junio C Hamano
2012-09-15 12:02 ` [PATCH 2/5] compat/wildmatch: remove static variable force_lower_case Nguyễn Thái Ngọc Duy
2012-09-15 12:02 ` [PATCH 3/5] compat/wildmatch: fix case-insensitive matching Nguyễn Thái Ngọc Duy
2012-09-15 12:02 ` Nguyễn Thái Ngọc Duy [this message]
2012-09-15 12:02 ` [PATCH 5/5] Support "**" in .gitignore and .gitattributes patterns using wildmatch() Nguyễn Thái Ngọc Duy
2012-09-15 14:27 ` How to create the " [PATCH 0/5]" first email? Philip Oakley
2012-09-15 17:08   ` Junio C Hamano
2012-09-17 22:55     ` Philip Oakley
2012-09-17 23:49       ` Junio C Hamano
2012-09-18  0:15         ` Jeff King
2012-09-18  0:36           ` Junio C Hamano
2012-09-18 18:55             ` Jeff King
2012-09-18 19:11               ` Junio C Hamano
2012-09-18 19:16                 ` Jeff King
2012-09-18 19:47                   ` Junio C Hamano
2012-09-18 20:10                     ` Philip Oakley
2012-09-18 20:16                       ` Jeff King
2012-09-18 20:16                     ` Jeff King
2012-09-18 20:42         ` Wesley J. Landaker
2012-09-23 12:03     ` Jan Engelhardt
2012-09-16 15:27 ` [PATCH v2 0/5] Support matching "**" in .gitattributes and .gitignore Nguyễn Thái Ngọc Duy
2012-09-16 15:27   ` [PATCH v2 1/5] Import wildmatch from rsync Nguyễn Thái Ngọc Duy
2012-09-16 15:27   ` [PATCH v2 2/5] compat/wildmatch: remove static variable force_lower_case Nguyễn Thái Ngọc Duy
2012-09-16 15:27   ` [PATCH v2 3/5] compat/wildmatch: fix case-insensitive matching Nguyễn Thái Ngọc Duy
2012-09-16 15:27   ` [PATCH v2 4/5] Integrate wildmatch to git Nguyễn Thái Ngọc Duy
2012-09-17  5:31     ` Junio C Hamano
2012-09-17  5:54       ` Junio C Hamano
2012-09-17  5:57         ` Nguyen Thai Ngoc Duy
2012-09-17 12:40         ` Nguyen Thai Ngoc Duy
2012-09-17 17:20           ` Junio C Hamano
2012-09-16 15:27   ` [PATCH v2 5/5] Support "**" in .gitignore and .gitattributes patterns using wildmatch() Nguyễn Thái Ngọc Duy
2012-09-25  7:01   ` [PATCH 6/5] side-step a make rule that builds t3070-wildmatch Johannes Sixt
  -- strict thread matches above, loose matches on Subject: below --
2012-09-26 11:25 [PATCH 0/5] wildmatch series update Nguyễn Thái Ngọc Duy
2012-09-26 11:25 ` [PATCH 4/5] Integrate wildmatch to git Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347710524-15404-5-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).