Merge branch 'ks/t7508-indent-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 26 Jun 2017 21:09:32 +0000 (14:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Jun 2017 21:09:32 +0000 (14:09 -0700)
Cosmetic update to a test.

* ks/t7508-indent-fix:
t7508: fix a broken indentation

1  2 
t/t7508-status.sh
diff --combined t/t7508-status.sh
index 7121a550c7ce789d5bcd2bb9a5d8c595e7baaa6a,b5860fcb8b40bad1a368ca3c7e320cb8e82f5da5..f7fe22a195e437d5a2aa9c28ea5991b53ae2c7e7
@@@ -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)
  
  test_expect_success 'git commit -m will commit a staged but ignored submodule' '
        git commit -uno -m message &&
        git status -s --ignore-submodules=dirty >output &&
-        test_i18ngrep ! "^M. sm" output &&
+       test_i18ngrep ! "^M. sm" output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
  '
  
 +test_expect_success 'show stash info with "--show-stash"' '
 +      git reset --hard &&
 +      git stash clear &&
 +      echo 1 >file &&
 +      git add file &&
 +      git stash &&
 +      git status >expected_default &&
 +      git status --show-stash >expected_with_stash &&
 +      test_i18ngrep "^Your stash currently has 1 entry$" expected_with_stash
 +'
 +
 +test_expect_success 'no stash info with "--show-stash --no-show-stash"' '
 +      git status --show-stash --no-show-stash >expected_without_stash &&
 +      test_cmp expected_default expected_without_stash
 +'
 +
 +test_expect_success '"status.showStash=false" weaker than "--show-stash"' '
 +      git -c status.showStash=false status --show-stash >actual &&
 +      test_cmp expected_with_stash actual
 +'
 +
 +test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' '
 +      git -c status.showStash=true status --no-show-stash >actual &&
 +      test_cmp expected_without_stash actual
 +'
 +
 +test_expect_success 'no additionnal info if no stash entries' '
 +      git stash clear &&
 +      git -c status.showStash=true status >actual &&
 +      test_cmp expected_without_stash actual
 +'
 +
  test_done