Merge branch 'ds/use-platform-regex-on-macos'
With a bit of header twiddling, use the native regexp library on macOS instead of the compat/ one. * ds/use-platform-regex-on-macos: grep: fix multibyte regex handling under macOS
This commit is contained in:
commit
410a0e520d
2
Makefile
2
Makefile
@ -1442,7 +1442,6 @@ ifeq ($(uname_S),Darwin)
|
|||||||
APPLE_COMMON_CRYPTO = YesPlease
|
APPLE_COMMON_CRYPTO = YesPlease
|
||||||
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
|
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
|
||||||
endif
|
endif
|
||||||
NO_REGEX = YesPlease
|
|
||||||
PTHREAD_LIBS =
|
PTHREAD_LIBS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -2980,6 +2979,7 @@ GIT-BUILD-OPTIONS: FORCE
|
|||||||
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
|
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
|
||||||
@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
|
@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
|
||||||
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
|
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
|
||||||
|
@echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
|
||||||
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
|
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
|
||||||
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
|
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
|
||||||
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
|
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
|
||||||
|
@ -40,6 +40,7 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
git_resolve_executable_dir(argv[0]);
|
git_resolve_executable_dir(argv[0]);
|
||||||
|
|
||||||
|
setlocale(LC_CTYPE, "");
|
||||||
git_setup_gettext();
|
git_setup_gettext();
|
||||||
|
|
||||||
initialize_the_repository();
|
initialize_the_repository();
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef NO_GETTEXT
|
#ifndef NO_GETTEXT
|
||||||
# include <locale.h>
|
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
# ifdef GIT_WINDOWS_NATIVE
|
# ifdef GIT_WINDOWS_NATIVE
|
||||||
|
|
||||||
@ -80,7 +79,6 @@ static int test_vsnprintf(const char *fmt, ...)
|
|||||||
|
|
||||||
static void init_gettext_charset(const char *domain)
|
static void init_gettext_charset(const char *domain)
|
||||||
{
|
{
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
charset = locale_charset();
|
charset = locale_charset();
|
||||||
bind_textdomain_codeset(domain, charset);
|
bind_textdomain_codeset(domain, charset);
|
||||||
|
|
||||||
|
@ -222,6 +222,7 @@ struct strbuf;
|
|||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <locale.h>
|
||||||
#ifdef NEEDS_SYS_PARAM_H
|
#ifdef NEEDS_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,6 +18,9 @@ test_invalid_grep_expression() {
|
|||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LC_ALL=en_US.UTF-8 test-tool regex '^.$' '¿' &&
|
||||||
|
test_set_prereq MB_REGEX
|
||||||
|
|
||||||
cat >hello.c <<EOF
|
cat >hello.c <<EOF
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -88,6 +91,10 @@ test_expect_success setup '
|
|||||||
echo unusual >"\"unusual\" pathname" &&
|
echo unusual >"\"unusual\" pathname" &&
|
||||||
echo unusual >"t/nested \"unusual\" pathname"
|
echo unusual >"t/nested \"unusual\" pathname"
|
||||||
fi &&
|
fi &&
|
||||||
|
if test_have_prereq MB_REGEX
|
||||||
|
then
|
||||||
|
echo "¿" >reverse-question-mark
|
||||||
|
fi &&
|
||||||
git add . &&
|
git add . &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -m initial
|
git commit -m initial
|
||||||
@ -569,6 +576,14 @@ do
|
|||||||
'
|
'
|
||||||
done
|
done
|
||||||
|
|
||||||
|
test_expect_success MB_REGEX 'grep exactly one char in single-char multibyte file' '
|
||||||
|
LC_ALL=en_US.UTF-8 git grep "^.$" reverse-question-mark
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success MB_REGEX 'grep two chars in single-char multibyte file' '
|
||||||
|
LC_ALL=en_US.UTF-8 test_expect_code 1 git grep ".." reverse-question-mark
|
||||||
|
'
|
||||||
|
|
||||||
cat >expected <<EOF
|
cat >expected <<EOF
|
||||||
file
|
file
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user