Merge branch 'bc/submodule-status-ignored'
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:36:08 +0000 (23:36 -0700)
committerJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:36:08 +0000 (23:36 -0700)
* bc/submodule-status-ignored:
Improve documentation concerning the status.submodulesummary setting
submodule: don't print status output with ignore=all
submodule: fix confusing variable name

1  2 
Documentation/config.txt
git-submodule.sh
t/t7401-submodule-summary.sh
t/t7508-status.sh
diff --combined Documentation/config.txt
index c3f70023ec36ba523d95293fef7b20da64e7be3a,424aa51edbffaf23026926dbe44a62a3fab6ac9b..aaae06fc5a95c84c7b237f1c08e2aa96169d0522
@@@ -170,8 -170,8 +170,8 @@@ advice.*:
        pushNeedsForce::
                Shown when linkgit:git-push[1] rejects an update that
                tries to overwrite a remote ref that points at an
 -              object that is not a committish, or make the remote
 -              ref point at an object that is not a committish.
 +              object that is not a commit-ish, or make the remote
 +              ref point at an object that is not a commit-ish.
        statusHints::
                Show directions on how to proceed from the current
                state in the output of linkgit:git-status[1], in
@@@ -553,20 -553,22 +553,20 @@@ sequence.editor:
        When not configured the default commit message editor is used instead.
  
  core.pager::
 -      The command that Git will use to paginate output.  Can
 -      be overridden with the `GIT_PAGER` environment
 -      variable.  Note that Git sets the `LESS` environment
 -      variable to `FRSX` if it is unset when it runs the
 -      pager.  One can change these settings by setting the
 -      `LESS` variable to some other value.  Alternately,
 -      these settings can be overridden on a project or
 -      global basis by setting the `core.pager` option.
 -      Setting `core.pager` has no effect on the `LESS`
 -      environment variable behaviour above, so if you want
 -      to override Git's default settings this way, you need
 -      to be explicit.  For example, to disable the S option
 -      in a backward compatible manner, set `core.pager`
 -      to `less -+S`.  This will be passed to the shell by
 -      Git, which will translate the final command to
 -      `LESS=FRSX less -+S`.
 +      Text viewer for use by Git commands (e.g., 'less').  The value
 +      is meant to be interpreted by the shell.  The order of preference
 +      is the `$GIT_PAGER` environment variable, then `core.pager`
 +      configuration, then `$PAGER`, and then the default chosen at
 +      compile time (usually 'less').
 ++
 +When the `LESS` environment variable is unset, Git sets it to `FRSX`
 +(if `LESS` environment variable is set, Git does not change it at
 +all).  If you want to selectively override Git's default setting
 +for `LESS`, you can set `core.pager` to e.g. `less -+S`.  This will
 +be passed to the shell by Git, which will translate the final
 +command to `LESS=FRSX less -+S`. The environment tells the command
 +to set the `S` option to chop long lines but the command line
 +resets it to the default to fold long lines.
  
  core.whitespace::
        A comma separated list of common whitespace problems to
@@@ -763,10 -765,6 +763,10 @@@ branch.<name>.rebase:
        instead of merging the default branch from the default remote when
        "git pull" is run. See "pull.rebase" for doing this in a non
        branch-specific manner.
 ++
 +      When preserve, also pass `--preserve-merges` along to 'git rebase'
 +      so that locally committed merge commits will not be flattened
 +      by running 'git pull'.
  +
  *NOTE*: this is a possibly dangerous operation; do *not* use
  it unless you understand the implications (see linkgit:git-rebase[1]
@@@ -789,8 -787,8 +789,8 @@@ browser.<tool>.path:
        working repository in gitweb (see linkgit:git-instaweb[1]).
  
  clean.requireForce::
 -      A boolean to make git-clean do nothing unless given -f
 -      or -n.   Defaults to true.
 +      A boolean to make git-clean do nothing unless given -f,
 +      -i or -n.   Defaults to true.
  
  color.branch::
        A boolean to enable/disable color in the output of
@@@ -1063,10 -1061,6 +1063,10 @@@ fetch.unpackLimit:
        especially on slow filesystems.  If not set, the value of
        `transfer.unpackLimit` is used instead.
  
 +fetch.prune::
 +      If true, fetch will automatically behave as if the `--prune`
 +      option was given on the command line.  See also `remote.<name>.prune`.
 +
  format.attach::
        Enable multipart/mixed attachments as the default for
        'format-patch'.  The value can also be a double quoted string
@@@ -1451,11 -1445,7 +1451,11 @@@ http.cookiefile:
        of the file to read cookies from should be plain HTTP headers or
        the Netscape/Mozilla cookie file format (see linkgit:curl[1]).
        NOTE that the file specified with http.cookiefile is only used as
 -      input. No cookies will be stored in the file.
 +      input unless http.saveCookies is set.
 +
 +http.savecookies::
 +      If set, store cookies received during requests to the file specified by
 +      http.cookiefile. Has no effect if http.cookiefile is unset.
  
  http.sslVerify::
        Whether to verify the SSL certificate when fetching or pushing
@@@ -1535,51 -1525,6 +1535,51 @@@ http.useragent:
        of common USER_AGENT strings (but not including those like git/1.7.1).
        Can be overridden by the 'GIT_HTTP_USER_AGENT' environment variable.
  
 +http.<url>.*::
 +      Any of the http.* options above can be applied selectively to some urls.
 +      For a config key to match a URL, each element of the config key is
 +      compared to that of the URL, in the following order:
 ++
 +--
 +. Scheme (e.g., `https` in `https://example.com/`). This field
 +  must match exactly between the config key and the URL.
 +
 +. Host/domain name (e.g., `example.com` in `https://example.com/`).
 +  This field must match exactly between the config key and the URL.
 +
 +. Port number (e.g., `8080` in `http://example.com:8080/`).
 +  This field must match exactly between the config key and the URL.
 +  Omitted port numbers are automatically converted to the correct
 +  default for the scheme before matching.
 +
 +. Path (e.g., `repo.git` in `https://example.com/repo.git`). The
 +  path field of the config key must match the path field of the URL
 +  either exactly or as a prefix of slash-delimited path elements.  This means
 +  a config key with path `foo/` matches URL path `foo/bar`.  A prefix can only
 +  match on a slash (`/`) boundary.  Longer matches take precedence (so a config
 +  key with path `foo/bar` is a better match to URL path `foo/bar` than a config
 +  key with just path `foo/`).
 +
 +. User name (e.g., `user` in `https://user@example.com/repo.git`). If
 +  the config key has a user name it must match the user name in the
 +  URL exactly. If the config key does not have a user name, that
 +  config key will match a URL with any user name (including none),
 +  but at a lower precedence than a config key with a user name.
 +--
 ++
 +The list above is ordered by decreasing precedence; a URL that matches
 +a config key's path is preferred to one that matches its user name. For example,
 +if the URL is `https://user@example.com/foo/bar` a config key match of
 +`https://example.com/foo` will be preferred over a config key match of
 +`https://user@example.com`.
 ++
 +All URLs are normalized before attempting any matching (the password part,
 +if embedded in the URL, is always ignored for matching purposes) so that
 +equivalent urls that are simply spelled differently will match properly.
 +Environment variable settings always override any matches.  The urls that are
 +matched against are those given directly to Git commands.  This means any URLs
 +visited as a result of a redirection do not participate in matching.
 +
  i18n.commitEncoding::
        Character encoding the commit messages are stored in; Git itself
        does not care per se, but this information is necessary e.g. when
@@@ -1880,10 -1825,6 +1880,10 @@@ pull.rebase:
        of merging the default branch from the default remote when "git
        pull" is run. See "branch.<name>.rebase" for setting this on a
        per-branch basis.
 ++
 +      When preserve, also pass `--preserve-merges` along to 'git rebase'
 +      so that locally committed merge commits will not be flattened
 +      by running 'git pull'.
  +
  *NOTE*: this is a possibly dangerous operation; do *not* use
  it unless you understand the implications (see linkgit:git-rebase[1]
@@@ -2083,12 -2024,6 +2083,12 @@@ remote.<name>.vcs:
        Setting this to a value <vcs> will cause Git to interact with
        the remote with the git-remote-<vcs> helper.
  
 +remote.<name>.prune::
 +      When set to true, fetching from this remote by default will also
 +      remove any remote-tracking branches which no longer exist on the
 +      remote (as if the `--prune` option was give on the command line).
 +      Overrides `fetch.prune` settings, if any.
 +
  remotes.<group>::
        The list of remotes which are fetched by "git remote update
        <group>".  See linkgit:git-remote[1].
@@@ -2183,13 -2118,6 +2183,13 @@@ status.branch:
        Set to true to enable --branch by default in linkgit:git-status[1].
        The option --no-branch takes precedence over this variable.
  
 +status.displayCommentPrefix::
 +      If set to true, linkgit:git-status[1] will insert a comment
 +      prefix before each output line (starting with
 +      `core.commentChar`, i.e. `#` by default). This was the
 +      behavior of linkgit:git-status[1] in Git 1.8.4 and previous.
 +      Defaults to false.
 +
  status.showUntrackedFiles::
        By default, linkgit:git-status[1] and linkgit:git-commit[1] show
        files which are not currently tracked by Git. Directories which
@@@ -2214,7 -2142,14 +2214,14 @@@ status.submodulesummary:
        If this is set to a non zero number or true (identical to -1 or an
        unlimited number), the submodule summary will be enabled and a
        summary of commits for modified submodules will be shown (see
-       --summary-limit option of linkgit:git-submodule[1]).
+       --summary-limit option of linkgit:git-submodule[1]). Please note
+       that the summary output command will be suppressed for all
+       submodules when `diff.ignoreSubmodules` is set to 'all' or only
+       for those submodules where `submodule.<name>.ignore=all`. To
+       also view the summary for ignored submodules you can either use
+       the --ignore-submodules=dirty command line option or the 'git
+       submodule summary' command, which shows a similar output but does
+       not honor these settings.
  
  submodule.<name>.path::
  submodule.<name>.url::
@@@ -2249,7 -2184,8 +2256,8 @@@ submodule.<name>.ignore:
        submodules that have untracked files in their work tree as changed.
        This setting overrides any setting made in .gitmodules for this submodule,
        both settings can be overridden on the command line by using the
-       "--ignore-submodules" option.
+       "--ignore-submodules" option. The 'git submodule' commands are not
+       affected by this setting.
  
  tar.umask::
        This variable can be used to restrict the permission bits of
@@@ -2288,17 -2224,6 +2296,17 @@@ uploadpack.allowtipsha1inwant:
        of a hidden ref (by default, such a request is rejected).
        see also `uploadpack.hiderefs`.
  
 +uploadpack.keepalive::
 +      When `upload-pack` has started `pack-objects`, there may be a
 +      quiet period while `pack-objects` prepares the pack. Normally
 +      it would output progress information, but if `--quiet` was used
 +      for the fetch, `pack-objects` will output nothing at all until
 +      the pack data begins. Some clients and networks may consider
 +      the server to be hung and give up. Setting this option instructs
 +      `upload-pack` to send an empty keepalive packet every
 +      `uploadpack.keepalive` seconds. Setting this option to 0
 +      disables keepalive packets entirely. The default is 5 seconds.
 +
  url.<base>.insteadOf::
        Any URL that starts with this value will be rewritten to
        start, instead, with <base>. In cases where some site serves a
diff --combined git-submodule.sh
index c17bef10629d3fe53e03647ee16de7f9de24dfb5,004b21cd1535bce39b24fc3db079f92baba7c989..896f1c9b820b6627da8d591469172d749bf0e700
@@@ -1032,13 -1032,20 +1032,20 @@@ cmd_summary() 
        # Get modified modules cared by user
        modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
                sane_egrep '^:([0-7]* )?160000' |
-               while read mod_src mod_dst sha1_src sha1_dst status name
+               while read mod_src mod_dst sha1_src sha1_dst status sm_path
                do
                        # Always show modules deleted or type-changed (blob<->module)
-                       test $status = D -o $status = T && echo "$name" && continue
+                       test $status = D -o $status = T && echo "$sm_path" && continue
+                       # Respect the ignore setting for --for-status.
+                       if test -n "$for_status"
+                       then
+                               name=$(module_name "$sm_path")
+                               ignore_config=$(get_submodule_config "$name" ignore none)
+                               test $status != A -a $ignore_config = all && continue
+                       fi
                        # Also show added or modified modules which are checked out
-                       GIT_DIR="$name/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
-                       echo "$name"
+                       GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
+                       echo "$sm_path"
                done
        )
  
                        echo
                fi
                echo
 -      done |
 -      if test -n "$for_status"; then
 -              if [ -n "$files" ]; then
 -                      gettextln "Submodules changed but not updated:" | git stripspace -c
 -              else
 -                      gettextln "Submodule changes to be committed:" | git stripspace -c
 -              fi
 -              printf "\n" | git stripspace -c
 -              git stripspace -c
 -      else
 -              cat
 -      fi
 +      done
  }
  #
  # List all submodules, prefixed with:
index 5a6d6d62ebcb0e506fcb0bd16dbd4a451ef3fbd1,81ae7c91a14cc550bb3ea2a534925c7e969d674a..366746f0d41342b38126eccc0f58c4ece64cb210
@@@ -104,6 -104,24 +104,24 @@@ EO
        test_cmp expected actual
  "
  
+ test_expect_success 'no ignore=all setting has any effect' "
+       git config -f .gitmodules submodule.sm1.path sm1 &&
+       git config -f .gitmodules submodule.sm1.ignore all &&
+       git config submodule.sm1.ignore all &&
+       git config diff.ignoreSubmodules all &&
+       git submodule summary >actual &&
+       cat >expected <<-EOF &&
+ * sm1 $head1...$head2 (1):
+   > Add foo3
+ EOF
+       test_cmp expected actual &&
+       git config --unset diff.ignoreSubmodules &&
+       git config --remove-section submodule.sm1 &&
+       git config -f .gitmodules --remove-section submodule.sm1
+ "
  commit_file sm1 &&
  head3=$(
        cd sm1 &&
@@@ -265,11 -283,13 +283,11 @@@ EO
  test_expect_success '--for-status' "
        git submodule summary --for-status HEAD^ >actual &&
        test_i18ncmp actual - <<EOF
 -# Submodule changes to be committed:
 -#
 -# * sm1 $head6...0000000:
 -#
 -# * sm2 0000000...$head7 (2):
 -#   > Add foo9
 -#
 +* sm1 $head6...0000000:
 +
 +* sm2 0000000...$head7 (2):
 +  > Add foo9
 +
  EOF
  "
  
diff --combined t/t7508-status.sh
index d8c531da765009b3b2261f1263a399b1d4c2a8b5,fb89fb90e1e9f37618961a40921c4f221d4e022b..6fb59f32937102b4b5cdb014774bee5dbfe5a1f0
@@@ -60,13 -60,8 +60,13 @@@ test_expect_success 'status (1)' 
        test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
  '
  
 +strip_comments () {
 +      tab='   '
 +      sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp &&
 +      rm "$1" && mv "$1".tmp "$1"
 +}
 +
  test_expect_success 'status --column' '
 -      COLUMNS=50 git status --column="column dense" >output &&
        cat >expect <<\EOF &&
  # On branch master
  # Changes to be committed:
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
 -#     dir1/untracked dir2/untracked untracked
 -#     dir2/modified  output
 +#     dir1/untracked dir2/untracked output
 +#     dir2/modified  expect         untracked
 +#
  EOF
 +      COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
 +      test_i18ncmp expect output
 +'
 +
 +test_expect_success 'status --column status.displayCommentPrefix=false' '
 +      strip_comments expect &&
 +      COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
        test_i18ncmp expect output
  '
  
@@@ -119,58 -106,28 +119,58 @@@ cat >expect <<\EO
  #     expect
  #     output
  #     untracked
 +#
  EOF
  
 -test_expect_success 'status (2)' '
 -      git status >output &&
 +test_expect_success 'status with status.displayCommentPrefix=true' '
 +      git -c status.displayCommentPrefix=true status >output &&
 +      test_i18ncmp expect output
 +'
 +
 +test_expect_success 'status with status.displayCommentPrefix=false' '
 +      strip_comments expect &&
 +      git -c status.displayCommentPrefix=false status >output &&
        test_i18ncmp expect output
  '
  
 +test_expect_success 'setup fake editor' '
 +      cat >.git/editor <<-\EOF &&
 +      #! /bin/sh
 +      cp "$1" output
 +EOF
 +      chmod 755 .git/editor
 +'
 +
 +commit_template_commented () {
 +      (
 +              EDITOR=.git/editor &&
 +              export EDITOR &&
 +              # Fails due to empty message
 +              test_must_fail git commit
 +      ) &&
 +      ! grep '^[^#]' output
 +}
 +
 +test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
 +      commit_template_commented
 +'
 +
  cat >expect <<\EOF
 -# On branch master
 -# Changes to be committed:
 -#     new file:   dir2/added
 -#
 -# Changes not staged for commit:
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 +On branch master
 +Changes to be committed:
 +      new file:   dir2/added
 +
 +Changes not staged for commit:
 +      modified:   dir1/modified
 +
 +Untracked files:
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
  EOF
  
  test_expect_success 'status (advice.statusHints false)' '
@@@ -228,35 -185,33 +228,35 @@@ test_expect_success 'status with gitign
        git status -s --ignored >output &&
        test_cmp expect output &&
  
 -      cat >expect <<-\EOF &&
 -      # On branch master
 -      # Changes to be committed:
 -      #   (use "git reset HEAD <file>..." to unstage)
 -      #
 -      #       new file:   dir2/added
 -      #
 -      # 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)
 -      #
 -      #       modified:   dir1/modified
 -      #
 -      # Untracked files:
 -      #   (use "git add <file>..." to include in what will be committed)
 -      #
 -      #       dir2/modified
 -      # Ignored files:
 -      #   (use "git add -f <file>..." to include in what will be committed)
 -      #
 -      #       .gitignore
 -      #       dir1/untracked
 -      #       dir2/untracked
 -      #       expect
 -      #       output
 -      #       untracked
 -      EOF
 +      cat >expect <<\EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir2/modified
 +
 +Ignored files:
 +  (use "git add -f <file>..." to include in what will be committed)
 +
 +      .gitignore
 +      dir1/untracked
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status --ignored >output &&
        test_i18ncmp expect output
  '
@@@ -291,31 -246,30 +291,31 @@@ test_expect_success 'status with gitign
        git status -s --ignored >output &&
        test_cmp expect output &&
  
 -      cat >expect <<-\EOF &&
 -      # On branch master
 -      # Changes to be committed:
 -      #   (use "git reset HEAD <file>..." to unstage)
 -      #
 -      #       new file:   dir2/added
 -      #
 -      # 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)
 -      #
 -      #       modified:   dir1/modified
 -      #
 -      # Ignored files:
 -      #   (use "git add -f <file>..." to include in what will be committed)
 -      #
 -      #       .gitignore
 -      #       dir1/untracked
 -      #       dir2/modified
 -      #       dir2/untracked
 -      #       expect
 -      #       output
 -      #       untracked
 -      EOF
 +      cat >expect <<\EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Ignored files:
 +  (use "git add -f <file>..." to include in what will be committed)
 +
 +      .gitignore
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status --ignored >output &&
        test_i18ncmp expect output
  '
@@@ -356,22 -310,22 +356,22 @@@ test_expect_success 'setup dir3' 
        : >dir3/untracked2
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files not listed (use -u option to show untracked files)
 -EOF
  test_expect_success 'status -uno' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files not listed (use -u option to show untracked files)
 +EOF
        git status -uno >output &&
        test_i18ncmp expect output
  '
@@@ -382,17 -336,17 +382,17 @@@ test_expect_success 'status (status.sho
        test_i18ncmp expect output
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#     new file:   dir2/added
 -#
 -# Changes not staged for commit:
 -#     modified:   dir1/modified
 -#
 -# Untracked files not listed
 -EOF
  test_expect_success 'status -uno (advice.statusHints false)' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +      new file:   dir2/added
 +
 +Changes not staged for commit:
 +      modified:   dir1/modified
 +
 +Untracked files not listed
 +EOF
        test_config advice.statusHints false &&
        git status -uno >output &&
        test_i18ncmp expect output
@@@ -413,32 -367,31 +413,32 @@@ test_expect_success 'status -s (status.
        test_cmp expect output
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     dir3/
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'status -unormal' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      dir3/
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status -unormal >output &&
        test_i18ncmp expect output
  '
@@@ -471,33 -424,32 +471,33 @@@ test_expect_success 'status -s (status.
        test_cmp expect output
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     dir3/untracked1
 -#     dir3/untracked2
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'status -uall' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      dir3/untracked1
 +      dir3/untracked2
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status -uall >output &&
        test_i18ncmp expect output
  '
@@@ -534,31 -486,31 +534,31 @@@ test_expect_success 'status -s (status.
        test_cmp expect output
  '
  
 -cat >expect <<\EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   ../dir2/added
 -#
 -# 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)
 -#
 -#     modified:   modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     untracked
 -#     ../dir2/modified
 -#     ../dir2/untracked
 -#     ../expect
 -#     ../output
 -#     ../untracked
 -EOF
 -
  test_expect_success 'status with relative paths' '
 +      cat >expect <<\EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   ../dir2/added
 +
 +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)
 +
 +      modified:   modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      untracked
 +      ../dir2/modified
 +      ../dir2/untracked
 +      ../expect
 +      ../output
 +      ../untracked
 +
 +EOF
        (cd dir1 && git status) >output &&
        test_i18ncmp expect output
  '
@@@ -605,31 -557,31 +605,31 @@@ test_expect_success 'setup unique color
  
  '
  
 -cat >expect <<\EOF
 -# On branch <GREEN>master<RESET>
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     <GREEN>new file:   dir2/added<RESET>
 -#
 -# 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)
 -#
 -#     <RED>modified:   dir1/modified<RESET>
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     <BLUE>dir1/untracked<RESET>
 -#     <BLUE>dir2/modified<RESET>
 -#     <BLUE>dir2/untracked<RESET>
 -#     <BLUE>expect<RESET>
 -#     <BLUE>output<RESET>
 -#     <BLUE>untracked<RESET>
 -EOF
 -
  test_expect_success 'status with color.ui' '
 +      cat >expect <<\EOF &&
 +On branch <GREEN>master<RESET>
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      <GREEN>new file:   dir2/added<RESET>
 +
 +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)
 +
 +      <RED>modified:   dir1/modified<RESET>
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      <BLUE>dir1/untracked<RESET>
 +      <BLUE>dir2/modified<RESET>
 +      <BLUE>dir2/untracked<RESET>
 +      <BLUE>expect<RESET>
 +      <BLUE>output<RESET>
 +      <BLUE>untracked<RESET>
 +
 +EOF
        test_config color.ui always &&
        git status | test_decode_color >output &&
        test_i18ncmp expect output
@@@ -733,33 -685,33 +733,33 @@@ test_expect_success 'status --porcelai
  
  '
  
 -cat >expect <<\EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
  
  
  test_expect_success 'status without relative paths' '
 +      cat >expect <<\EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
  
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        test_config status.relativePaths false &&
        (cd dir1 && git status) >output &&
        test_i18ncmp expect output
@@@ -785,24 -737,23 +785,24 @@@ test_expect_success 'status -s without 
  
  '
  
 -cat <<EOF >expect
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'dry-run of partial commit excluding new file in index' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git commit --dry-run dir1/modified >output &&
        test_i18ncmp expect output
  '
@@@ -827,32 -778,31 +827,32 @@@ test_expect_success 'setup status submo
        git add sm
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#     new file:   sm
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'status submodule summary is disabled by default' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +      new file:   sm
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status >output &&
        test_i18ncmp expect output
  '
@@@ -887,52 -837,41 +887,52 @@@ test_expect_success 'status -s --untrac
  
  head=$(cd sm && git rev-parse --short=7 --verify HEAD)
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#     new file:   sm
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Submodule changes to be committed:
 -#
 -# * sm 0000000...$head (1):
 -#   > Add foo
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'status submodule summary' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      new file:   dir2/added
 +      new file:   sm
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Submodule changes to be committed:
 +
 +* sm 0000000...$head (1):
 +  > Add foo
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git config status.submodulesummary 10 &&
        git status >output &&
        test_i18ncmp expect output
  '
  
 +test_expect_success 'status submodule summary with status.displayCommentPrefix=false' '
 +      strip_comments expect &&
 +      git -c status.displayCommentPrefix=false status >output &&
 +      test_i18ncmp expect output
 +'
 +
 +test_expect_success 'commit with submodule summary ignores status.displayCommentPrefix' '
 +      commit_template_commented
 +'
 +
  cat >expect <<EOF
   M dir1/modified
  A  dir2/added
@@@ -949,27 -888,26 +949,27 @@@ test_expect_success 'status -s submodul
        test_cmp expect output
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 +test_expect_success 'status submodule summary (clean submodule): commit' '
 +      cat >expect <<EOF &&
 +On branch master
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
  no changes added to commit (use "git add" and/or "git commit -a")
  EOF
 -test_expect_success 'status submodule summary (clean submodule): commit' '
        git commit -m "commit submodule" &&
        git config status.submodulesummary 10 &&
        test_must_fail git commit --dry-run >output &&
@@@ -999,37 -937,36 +999,37 @@@ test_expect_success 'status -z implies 
        test_cmp expect output
  '
  
 -cat >expect <<EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD^1 <file>..." to unstage)
 -#
 -#     new file:   dir2/added
 -#     new file:   sm
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Submodule changes to be committed:
 -#
 -# * sm 0000000...$head (1):
 -#   > Add foo
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
  test_expect_success 'commit --dry-run submodule summary (--amend)' '
 +      cat >expect <<EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD^1 <file>..." to unstage)
 +
 +      new file:   dir2/added
 +      new file:   sm
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Submodule changes to be committed:
 +
 +* sm 0000000...$head (1):
 +  > Add foo
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git config status.submodulesummary 10 &&
        git commit --dry-run --amend >output &&
        test_i18ncmp expect output
@@@ -1054,37 -991,37 +1054,37 @@@ test_expect_success POSIXPERM,SANITY 's
  new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
  touch .gitmodules
  
 -cat > expect << EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     modified:   sm
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Submodule changes to be committed:
 -#
 -# * sm $head...$new_head (1):
 -#   > Add bar
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     .gitmodules
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
 -
  test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
 +      cat > expect << EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      modified:   sm
 +
 +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)
 +
 +      modified:   dir1/modified
 +
 +Submodule changes to be committed:
 +
 +* sm $head...$new_head (1):
 +  > Add bar
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      .gitmodules
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        echo modified  sm/untracked &&
        git status --ignore-submodules=untracked >output &&
        test_i18ncmp expect output
@@@ -1164,39 -1101,39 +1164,39 @@@ test_expect_success '.git/config ignore
        git config -f .gitmodules  --remove-section submodule.subname
  '
  
 -cat > expect << EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     modified:   sm
 -#
 -# 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)
 -#   (commit or discard the untracked or modified content in submodules)
 -#
 -#     modified:   dir1/modified
 -#     modified:   sm (modified content)
 -#
 -# Submodule changes to be committed:
 -#
 -# * sm $head...$new_head (1):
 -#   > Add bar
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     .gitmodules
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
 -
  test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
 +      cat > expect << EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      modified:   sm
 +
 +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)
 +  (commit or discard the untracked or modified content in submodules)
 +
 +      modified:   dir1/modified
 +      modified:   sm (modified content)
 +
 +Submodule changes to be committed:
 +
 +* sm $head...$new_head (1):
 +  > Add bar
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      .gitmodules
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status --ignore-submodules=untracked > output &&
        test_i18ncmp expect output
  '
@@@ -1222,43 -1159,43 +1222,43 @@@ test_expect_success ".git/config ignore
  
  head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
  
 -cat > expect << EOF
 -# On branch master
 -# Changes to be committed:
 -#   (use "git reset HEAD <file>..." to unstage)
 -#
 -#     modified:   sm
 -#
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#     modified:   sm (new commits)
 -#
 -# Submodule changes to be committed:
 -#
 -# * sm $head...$new_head (1):
 -#   > Add bar
 -#
 -# Submodules changed but not updated:
 -#
 -# * sm $new_head...$head2 (1):
 -#   > 2nd commit
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     .gitmodules
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 -EOF
 -
  test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
 +      cat > expect << EOF &&
 +On branch master
 +Changes to be committed:
 +  (use "git reset HEAD <file>..." to unstage)
 +
 +      modified:   sm
 +
 +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)
 +
 +      modified:   dir1/modified
 +      modified:   sm (new commits)
 +
 +Submodule changes to be committed:
 +
 +* sm $head...$new_head (1):
 +  > Add bar
 +
 +Submodules changed but not updated:
 +
 +* sm $new_head...$head2 (1):
 +  > 2nd commit
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      .gitmodules
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
 +EOF
        git status --ignore-submodules=untracked > output &&
        test_i18ncmp expect output
  '
@@@ -1339,48 -1276,47 +1339,48 @@@ cat > expect << EO
  ;     expect
  ;     output
  ;     untracked
 +;
  EOF
  
  test_expect_success "status (core.commentchar with submodule summary)" '
        test_config core.commentchar ";" &&
 -      git status >output &&
 +      git -c status.displayCommentPrefix=true status >output &&
        test_i18ncmp expect output
  '
  
  test_expect_success "status (core.commentchar with two chars with submodule summary)" '
        test_config core.commentchar ";;" &&
 -      git status >output &&
 +      git -c status.displayCommentPrefix=true status >output &&
        test_i18ncmp expect output
  '
  
 -cat > expect << EOF
 -# On branch master
 -# 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)
 -#
 -#     modified:   dir1/modified
 -#
 -# Untracked files:
 -#   (use "git add <file>..." to include in what will be committed)
 -#
 -#     .gitmodules
 -#     dir1/untracked
 -#     dir2/modified
 -#     dir2/untracked
 -#     expect
 -#     output
 -#     untracked
 +test_expect_success "--ignore-submodules=all suppresses submodule summary" '
 +      cat > expect << EOF &&
 +On branch master
 +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)
 +
 +      modified:   dir1/modified
 +
 +Untracked files:
 +  (use "git add <file>..." to include in what will be committed)
 +
 +      .gitmodules
 +      dir1/untracked
 +      dir2/modified
 +      dir2/untracked
 +      expect
 +      output
 +      untracked
 +
  no changes added to commit (use "git add" and/or "git commit -a")
  EOF
 -
 -test_expect_success "--ignore-submodules=all suppresses submodule summary" '
        git status --ignore-submodules=all > output &&
        test_i18ncmp expect output
  '
  
- test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
+ test_expect_success '.gitmodules ignore=all suppresses submodule summary' '
        git config --add -f .gitmodules submodule.subname.ignore all &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
        git config -f .gitmodules  --remove-section submodule.subname
  '
  
- test_expect_failure '.git/config ignore=all suppresses submodule summary' '
+ test_expect_success '.git/config ignore=all suppresses submodule summary' '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore all &&