From: Junio C Hamano Date: Mon, 19 Nov 2018 07:24:39 +0000 (+0900) Subject: Merge branch 'ab/dynamic-gettext-poison' X-Git-Tag: v2.20.0-rc1~17 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/954932667dac15885165cdb579acbf6a774fe140?hp=-c Merge branch 'ab/dynamic-gettext-poison' Our testing framework uses a special i18n "poisoned localization" feature to find messages that ought to stay constant but are incorrectly marked to be translated. This feature has been made into a runtime option (it used to be a compile-time option). * ab/dynamic-gettext-poison: Makefile: ease dynamic-gettext-poison transition i18n: make GETTEXT_POISON a runtime option --- 954932667dac15885165cdb579acbf6a774fe140 diff --combined .travis.yml index a5a82d6832,4523a2e5ec..03c8e4c613 --- a/.travis.yml +++ b/.travis.yml @@@ -1,5 -1,7 +1,5 @@@ language: c -sudo: false - cache: directories: - $HOME/travis-cache @@@ -12,9 -14,19 +12,9 @@@ compiler - clang - gcc -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - language-pack-is - - git-svn - - apache2 - - gcc-8 - matrix: include: - - env: jobname=GETTEXT_POISON + - env: jobname=GIT_TEST_GETTEXT_POISON os: linux compiler: addons: @@@ -40,11 -52,22 +40,11 @@@ - env: jobname=StaticAnalysis os: linux compiler: - addons: - apt: - packages: - - coccinelle - before_install: script: ci/run-static-analysis.sh after_failure: - env: jobname=Documentation os: linux compiler: - addons: - apt: - packages: - - asciidoc - - xmlto - before_install: script: ci/test-documentation.sh after_failure: diff --combined Makefile index b8d5f1a27f,6b492f44a6..6579c01f9f --- a/Makefile +++ b/Makefile @@@ -59,13 -59,6 +59,13 @@@ all: # Define CURL_CONFIG to curl's configuration program that prints information # about the library (e.g., its version number). The default is 'curl-config'. # +# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl, +# if you do not want to rely on the libraries provided by CURL_CONFIG. The +# default value is a result of `curl-config --libs`. An example value for +# CURL_LDFLAGS is as follows: +# +# CURL_LDFLAGS=-lcurl +# # Define NO_EXPAT if you do not have expat installed. git-http-push is # not built, and you cannot push using http:// and https:// transports (dumb). # @@@ -190,6 -183,10 +190,6 @@@ # # Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin). # -# Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix). -# -# Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix). -# # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin). # # Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv. @@@ -365,11 -362,6 +365,6 @@@ # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the # user. # - # Define GETTEXT_POISON if you are debugging the choice of strings marked - # for translation. In a GETTEXT_POISON build, you can turn all strings marked - # for translation into gibberish by setting the GIT_GETTEXT_POISON variable - # (to any value) in your environment. - # # Define JSMIN to point to JavaScript minifier that functions as # a filter to have gitweb.js minified. # @@@ -754,7 -746,6 +749,7 @@@ TEST_BUILTINS_OBJS += test-sigchain. TEST_BUILTINS_OBJS += test-strcmp-offset.o TEST_BUILTINS_OBJS += test-string-list.o TEST_BUILTINS_OBJS += test-submodule-config.o +TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o TEST_BUILTINS_OBJS += test-subprocess.o TEST_BUILTINS_OBJS += test-urlmatch-normalization.o TEST_BUILTINS_OBJS += test-wildmatch.o @@@ -996,7 -987,6 +991,7 @@@ LIB_OBJS += sub-process. LIB_OBJS += symlinks.o LIB_OBJS += tag.o LIB_OBJS += tempfile.o +LIB_OBJS += thread-utils.o LIB_OBJS += tmp-objdir.o LIB_OBJS += trace.o LIB_OBJS += trailer.o @@@ -1312,17 -1302,20 +1307,17 @@@ els ifdef CURLDIR # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case. BASIC_CFLAGS += -I$(CURLDIR)/include - CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl + CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) else - CURL_LIBCURL = -lcurl - endif - ifdef NEEDS_SSL_WITH_CURL - CURL_LIBCURL += -lssl - ifdef NEEDS_CRYPTO_WITH_SSL - CURL_LIBCURL += -lcrypto - endif - endif - ifdef NEEDS_IDN_WITH_CURL - CURL_LIBCURL += -lidn + CURL_LIBCURL = endif +ifdef CURL_LDFLAGS + CURL_LIBCURL += $(CURL_LDFLAGS) +else + CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs) +endif + REMOTE_CURL_PRIMARY = git-remote-http$X REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) @@@ -1454,7 -1447,7 +1449,7 @@@ ifdef NO_SYMLINK_HEA BASIC_CFLAGS += -DNO_SYMLINK_HEAD endif ifdef GETTEXT_POISON - BASIC_CFLAGS += -DGETTEXT_POISON + $(warning The GETTEXT_POISON option has been removed in favor of runtime GIT_TEST_GETTEXT_POISON. See t/README!) endif ifdef NO_GETTEXT BASIC_CFLAGS += -DNO_GETTEXT @@@ -1678,6 -1671,7 +1673,6 @@@ ifdef NO_PTHREAD else BASIC_CFLAGS += $(PTHREAD_CFLAGS) EXTLIBS += $(PTHREAD_LIBS) - LIB_OBJS += thread-utils.o endif ifdef HAVE_PATHS_H @@@ -2071,7 -2065,7 +2066,7 @@@ $(BUILT_INS): git$ command-list.h: generate-cmdlist.sh command-list.txt -command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt +command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\ @@@ -2111,7 -2105,7 +2106,7 @@@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEF $(QUIET_GEN)$(cmd_munge_script) && \ mv $@+ $@ -git.res: git.rc GIT-VERSION-FILE +git.res: git.rc GIT-VERSION-FILE GIT-PREFIX $(QUIET_RC)$(RC) \ $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \ $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \ @@@ -2604,7 -2598,6 +2599,6 @@@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEX @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+ endif @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+ - @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@+ ifdef GIT_PERF_REPEAT_COUNT @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+ endif @@@ -3099,16 -3092,14 +3093,16 @@@ cover_db_html: cover_d # An example command to build against libFuzzer from LLVM 4.0.0: # # make CC=clang CXX=clang++ \ -# CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \ +# FUZZ_CXXFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \ # LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \ # fuzz-all # +FUZZ_CXXFLAGS ?= $(CFLAGS) + .PHONY: fuzz-all $(FUZZ_PROGRAMS): all - $(QUIET_LINK)$(CXX) $(CFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \ + $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \ $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@ fuzz-all: $(FUZZ_PROGRAMS) diff --combined t/README index 3df5d12e46,25c4ba3419..28711cc508 --- a/t/README +++ b/t/README @@@ -154,7 -154,6 +154,7 @@@ appropriately before running "make" As the names depend on the tests' file names, it is safe to run the tests with this option in parallel. +-V:: --verbose-log:: Write verbose output to the same logfile as `--tee`, but do _not_ write it to stdout. Unlike `--tee --verbose`, this option @@@ -302,6 -301,12 +302,12 @@@ that cannot be easily covered by a few could be enabled by running the test suite with correct GIT_TEST_ environment set. + GIT_TEST_GETTEXT_POISON= turns all strings marked for + translation into gibberish if non-empty (think "test -n"). Used for + spotting those tests that need to be marked with a C_LOCALE_OUTPUT + prerequisite when adding more strings for translation. See "Testing + marked strings" in po/README for details. + GIT_TEST_SPLIT_INDEX= forces split-index mode on the whole test suite. Accept any boolean values that are accepted by git-config. @@@ -339,19 -344,11 +345,19 @@@ for the index version specified. Can b GIT_TEST_PRELOAD_INDEX= exercises the preload-index code path by overriding the minimum number of cache entries required per thread. +GIT_TEST_REBASE_USE_BUILTIN=, when false, disables the +builtin version of git-rebase. See 'rebase.useBuiltin' in +git-config(1). + GIT_TEST_INDEX_THREADS= enables exercising the multi-threaded loading of the index for the whole test suite by bypassing the default number of cache entries and thread minimums. Setting this to 1 will make the index loading single threaded. +GIT_TEST_MULTI_PACK_INDEX=, when true, forces the multi-pack- +index to be written after every 'git repack' command, and overrides the +'core.multiPackIndex' setting to true. + Naming Tests ------------ diff --combined t/t3406-rebase-message.sh index 2c79eed4fe,2bdcf83808..38bd876cab --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@@ -77,18 -77,11 +77,18 @@@ test_expect_success 'rebase -n override # "Does not point to a valid commit: invalid-ref" # # NEEDSWORK: This "grep" is fine in real non-C locales, but - # GETTEXT_POISON poisons the refname along with the enclosing + # GIT_TEST_GETTEXT_POISON poisons the refname along with the enclosing # error message. test_expect_success 'rebase --onto outputs the invalid ref' ' test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err && test_i18ngrep "invalid-ref" err ' +test_expect_success 'error out early upon -C or --whitespace=' ' + test_must_fail git rebase -Cnot-a-number HEAD 2>err && + test_i18ngrep "numerical value" err && + test_must_fail git rebase --whitespace=bad HEAD 2>err && + test_i18ngrep "Invalid whitespace option" err +' + test_done diff --combined t/test-lib-functions.sh index d158c8d0bf,2f42b3653c..4397c01be0 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@@ -747,29 -747,6 +747,29 @@@ test_cmp() $GIT_TEST_CMP "$@" } +# Check that the given config key has the expected value. +# +# test_cmp_config [-C ] +# [...] +# +# for example to check that the value of core.bar is foo +# +# test_cmp_config foo core.bar +# +test_cmp_config() { + local GD && + if test "$1" = "-C" + then + shift && + GD="-C $1" && + shift + fi && + printf "%s\n" "$1" >expect.config && + shift && + git $GD config "$@" >actual.config && + test_cmp expect.config actual.config +} + # test_cmp_bin - helper to compare binary files test_cmp_bin() { @@@ -778,16 -755,16 +778,16 @@@ # Use this instead of test_cmp to compare files that contain expected and # actual output from git commands that can be translated. When running - # under GETTEXT_POISON this pretends that the command produced expected + # under GIT_TEST_GETTEXT_POISON this pretends that the command produced expected # results. test_i18ncmp () { - test -n "$GETTEXT_POISON" || test_cmp "$@" + ! test_have_prereq C_LOCALE_OUTPUT || test_cmp "$@" } # Use this instead of "grep expected-string actual" to see if the # output from a git command that can be translated either contains an # expected string, or does not contain an unwanted one. When running - # under GETTEXT_POISON this pretends that the command produced expected + # under GIT_TEST_GETTEXT_POISON this pretends that the command produced expected # results. test_i18ngrep () { eval "last_arg=\${$#}" @@@ -802,7 -779,7 +802,7 @@@ error "bug in the test script: too few parameters to test_i18ngrep" fi - if test -n "$GETTEXT_POISON" + if test_have_prereq !C_LOCALE_OUTPUT then # pretend success return 0 diff --combined t/test-lib.sh index aba66cafa2,edee38a264..219ca1d520 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -67,7 -67,7 +67,7 @@@ case "$GIT_TEST_TEE_STARTED, $* " i done,*) # do not redirect again ;; -*' --tee '*|*' --va'*|*' --verbose-log '*) +*' --tee '*|*' --va'*|*' -V '*|*' --verbose-log '*) mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results" BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)" @@@ -95,6 -95,16 +95,16 @@@ PAGER=ca TZ=UTC export LANG LC_ALL PAGER TZ EDITOR=: + + # GIT_TEST_GETTEXT_POISON should not influence git commands executed + # during initialization of test-lib and the test repo. Back it up, + # unset and then restore after initialization is finished. + if test -n "$GIT_TEST_GETTEXT_POISON" + then + GIT_TEST_GETTEXT_POISON_ORIG=$GIT_TEST_GETTEXT_POISON + unset GIT_TEST_GETTEXT_POISON + fi + # A call to "unset" with no arguments causes at least Solaris 10 # /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets # deriving from the command substitution clustered with the other @@@ -316,7 -326,7 +326,7 @@@ d echo >&2 "warning: ignoring -x; '$0' is untraceable without BASH_XTRACEFD" fi shift ;; - --verbose-log) + -V|--verbose-log) verbose_log=t shift ;; *) @@@ -1104,13 -1114,15 +1114,15 @@@ test -n "$USE_LIBPCRE1" && test_set_pre test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2 test -z "$NO_GETTEXT" && test_set_prereq GETTEXT + if test -n "$GIT_TEST_GETTEXT_POISON_ORIG" + then + GIT_TEST_GETTEXT_POISON=$GIT_TEST_GETTEXT_POISON_ORIG + unset GIT_TEST_GETTEXT_POISON_ORIG + fi + # Can we rely on git's output in the C locale? - if test -n "$GETTEXT_POISON" + if test -z "$GIT_TEST_GETTEXT_POISON" then - GIT_GETTEXT_POISON=YesPlease - export GIT_GETTEXT_POISON - test_set_prereq GETTEXT_POISON - else test_set_prereq C_LOCALE_OUTPUT fi @@@ -1268,7 -1280,3 +1280,7 @@@ test_lazy_prereq CURL test_lazy_prereq SHA1 ' test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ' + +test_lazy_prereq REBASE_P ' + test -z "$GIT_TEST_SKIP_REBASE_P" +'