Merge branch 'ab/fix-poison-tests'
authorJunio C Hamano <gitster@pobox.com>
Tue, 23 May 2017 04:46:08 +0000 (13:46 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 May 2017 04:46:09 +0000 (13:46 +0900)
Update tests to pass under GETTEXT_POISON (a mechanism to ensure
that output strings that should not be translated are not
translated by mistake), and tell TravisCI to run them.

* ab/fix-poison-tests:
travis-ci: add job to run tests with GETTEXT_POISON
travis-ci: setup "prove cache" in "script" step
tests: fix tests broken under GETTEXT_POISON=YesPlease

1  2 
.travis.yml
t/t0027-auto-crlf.sh
t/t7508-status.sh
diff --combined .travis.yml
index 48cb00a581ec784446434d69ffdfe7a84612de12,6dd73d1f02bd0a795fc706c82020d459b2cea49e..278943d14a244b6b748078ff9ee18a17f58e7b45
@@@ -39,6 -39,11 +39,11 @@@ env
  
  matrix:
    include:
+     - env: GETTEXT_POISON=YesPlease
+       os: linux
+       compiler:
+       addons:
+       before_install:
      - env: Windows
        os: linux
        compiler:
@@@ -52,7 -57,6 +57,7 @@@
        after_failure:
      - env: Linux32
        os: linux
 +      compiler:
        services:
          - docker
        before_install:
        after_failure:
      - env: Documentation
        os: linux
 -      compiler: clang
 +      compiler:
        addons:
          apt:
            packages:
            - asciidoc
            - xmlto
        before_install:
 -      before_script:
 +      before_script: gem install asciidoctor
        script: ci/test-documentation.sh
        after_failure:
  
@@@ -135,12 -139,14 +140,14 @@@ before_install
      p4 -V | grep Rev.;
      echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)";
      git-lfs version;
-     mkdir -p $HOME/travis-cache;
-     ln -s $HOME/travis-cache/.prove t/.prove;
  
  before_script: make --jobs=2
  
- script: make --quiet test
+ script:
+   - >
+     mkdir -p $HOME/travis-cache;
+     ln -s $HOME/travis-cache/.prove t/.prove;
+     make --quiet test;
  
  after_failure:
    - >
diff --combined t/t0027-auto-crlf.sh
index effc3db0d580e7c18c6c52585fb681a3001ff66b,81609af7bbdf2f0ec0e16b4b7374dfc20a96001f..deb3ae7813052d01b6dab92586e2c37d313ef8ff
@@@ -4,6 -4,12 +4,6 @@@ test_description='CRLF conversion all c
  
  . ./test-lib.sh
  
 -if ! test_have_prereq EXPENSIVE
 -then
 -      skip_all="EXPENSIVE not set"
 -      test_done
 -fi
 -
  compare_files () {
        tr '\015\000' QN <"$1" >"$1".expect &&
        tr '\015\000' QN <"$2" | tr -d 'Z' >"$2".actual &&
@@@ -69,7 -75,7 +69,7 @@@ check_warning () 
        *) echo >&2 "Illegal 1": "$1" ; return false ;;
        esac
        grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq  >"$2".actual
-       test_cmp "$2".expect "$2".actual
+       test_i18ncmp "$2".expect "$2".actual
  }
  
  commit_check_warn () {
diff --combined t/t7508-status.sh
index 567c4d4bab43a3bfeb46dc8b5751b87585efd066,5edcc6edfe651f638921b9148be9579312a47adc..79427840a4faed765c06c9c9dcf35e4ec3c43c43
@@@ -32,17 -32,6 +32,17 @@@ test_expect_success 'commit -h in broke
        test_i18ngrep "[Uu]sage" broken/usage
  '
  
 +test_expect_success 'create upstream branch' '
 +      git checkout -b upstream &&
 +      test_commit upstream1 &&
 +      test_commit upstream2 &&
 +      # leave the first commit on master as root because several
 +      # tests depend on this case; for our upstream we only
 +      # care about commit counts anyway, so a totally divergent
 +      # history is OK
 +      git checkout --orphan master
 +'
 +
  test_expect_success 'setup' '
        : >tracked &&
        : >modified &&
@@@ -64,9 -53,7 +64,9 @@@
        echo 1 >dir1/modified &&
        echo 2 >dir2/modified &&
        echo 3 >dir2/added &&
 -      git add dir2/added
 +      git add dir2/added &&
 +
 +      git branch --set-upstream-to=upstream
  '
  
  test_expect_success 'status (1)' '
@@@ -88,10 -75,6 +88,10 @@@ EO
  test_expect_success 'status --column' '
        cat >expect <<\EOF &&
  # On branch master
 +# Your branch and '\''upstream'\'' have diverged,
 +# and have 1 and 2 different commits each, respectively.
 +#   (use "git pull" to merge the remote branch into yours)
 +#
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
@@@ -122,10 -105,6 +122,10 @@@ test_expect_success 'status --column st
  
  cat >expect <<\EOF
  # On branch master
 +# Your branch and 'upstream' have diverged,
 +# and have 1 and 2 different commits each, respectively.
 +#   (use "git pull" to merge the remote branch into yours)
 +#
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
@@@ -199,9 -178,6 +199,9 @@@ test_expect_success 'commit ignores sta
  
  cat >expect <<\EOF
  On branch master
 +Your branch and 'upstream' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +
  Changes to be committed:
        new file:   dir2/added
  
@@@ -272,10 -248,6 +272,10 @@@ test_expect_success 'status with gitign
  
        cat >expect <<\EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -341,10 -313,6 +341,10 @@@ test_expect_success 'status with gitign
  
        cat >expect <<\EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -380,7 -348,7 +380,7 @@@ output
  EOF
  
  cat >expect <<\EOF
 -## master
 +## master...upstream [ahead 1, behind 2]
   M dir1/modified
  A  dir2/added
  ?? dir1/untracked
@@@ -392,7 -360,7 +392,7 @@@ EO
  test_expect_success 'status -s -b' '
  
        git status -s -b >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
  
  '
  
@@@ -402,7 -370,7 +402,7 @@@ test_expect_success 'status -s -z -b' 
        git status -s -z -b >output &&
        nul_to_q <output >output.q &&
        mv output.q output &&
-       test_cmp expect output
+       test_i18ncmp expect output
  '
  
  test_expect_success 'setup dir3' '
  test_expect_success 'status -uno' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -444,9 -408,6 +444,9 @@@ test_expect_success 'status (status.sho
  test_expect_success 'status -uno (advice.statusHints false)' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +
  Changes to be committed:
        new file:   dir2/added
  
@@@ -478,10 -439,6 +478,10 @@@ test_expect_success 'status -s (status.
  test_expect_success 'status -unormal' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -536,10 -493,6 +536,10 @@@ test_expect_success 'status -s (status.
  test_expect_success 'status -uall' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -599,10 -552,6 +599,10 @@@ test_expect_success 'status -s (status.
  test_expect_success 'status with relative paths' '
        cat >expect <<\EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -661,19 -610,13 +661,19 @@@ test_expect_success 'status --porcelai
  test_expect_success 'setup unique colors' '
  
        git config status.color.untracked blue &&
 -      git config status.color.branch green
 +      git config status.color.branch green &&
 +      git config status.color.localBranch yellow &&
 +      git config status.color.remoteBranch cyan
  
  '
  
  test_expect_success 'status with color.ui' '
        cat >expect <<\EOF &&
  On branch <GREEN>master<RESET>
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -732,7 -675,7 +732,7 @@@ test_expect_success 'status -s with col
  '
  
  cat >expect <<\EOF
 -## <GREEN>master<RESET>
 +## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>]
   <RED>M<RESET> dir1/modified
  <GREEN>A<RESET>  dir2/added
  <BLUE>??<RESET> dir1/untracked
@@@ -744,7 -687,7 +744,7 @@@ EO
  test_expect_success 'status -s -b with color.status' '
  
        git status -s -b | test_decode_color >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
  
  '
  
@@@ -783,7 -726,7 +783,7 @@@ test_expect_success 'status --porcelai
  
        git status --porcelain -b >output &&
        {
 -              echo "## master" &&
 +              echo "## master...upstream [ahead 1, behind 2]" &&
                cat expect
        } >tmp &&
        mv tmp expect &&
  test_expect_success 'status without relative paths' '
        cat >expect <<\EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -846,10 -785,6 +846,10 @@@ test_expect_success 'status -s without 
  test_expect_success 'dry-run of partial commit excluding new file in index' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -890,10 -825,6 +890,10 @@@ test_expect_success 'setup status submo
  test_expect_success 'status submodule summary is disabled by default' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -950,10 -881,6 +950,10 @@@ head=$(cd sm && git rev-parse --short=
  test_expect_success 'status submodule summary' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 1 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -1012,10 -939,6 +1012,10 @@@ test_expect_success 'status -s submodul
  test_expect_success 'status submodule summary (clean submodule): commit' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes not staged for commit:
    (use "git add <file>..." to update what will be committed)
    (use "git checkout -- <file>..." to discard changes in working directory)
@@@ -1062,10 -985,6 +1062,10 @@@ test_expect_success 'status -z implies 
  test_expect_success 'commit --dry-run submodule summary (--amend)' '
        cat >expect <<EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD^1 <file>..." to unstage)
  
@@@ -1119,10 -1038,6 +1119,10 @@@ touch .gitmodule
  test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
        cat > expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -1231,10 -1146,6 +1231,10 @@@ test_expect_success '.git/config ignore
  test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
        cat > expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -1291,10 -1202,6 +1291,10 @@@ head2=$(cd sm && git commit -q -m "2nd 
  test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
        cat > expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -1375,10 -1282,6 +1375,10 @@@ test_expect_success ".git/config ignore
  
  cat > expect << EOF
  ; On branch master
 +; Your branch and 'upstream' have diverged,
 +; and have 2 and 2 different commits each, respectively.
 +;   (use "git pull" to merge the remote branch into yours)
 +;
  ; Changes to be committed:
  ;   (use "git reset HEAD <file>..." to unstage)
  ;
@@@ -1426,10 -1329,6 +1426,10 @@@ test_expect_success "status (core.comme
  test_expect_success "--ignore-submodules=all suppresses submodule summary" '
        cat > expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes not staged for commit:
    (use "git add <file>..." to update what will be committed)
    (use "git checkout -- <file>..." to discard changes in working directory)
  test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
        cat > expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
  
@@@ -1577,10 -1472,6 +1577,10 @@@ test_expect_success 'git commit --dry-r
        git add sm &&
        cat >expect << EOF &&
  On branch master
 +Your branch and '\''upstream'\'' have diverged,
 +and have 2 and 2 different commits each, respectively.
 +  (use "git pull" to merge the remote branch into yours)
 +
  Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)