]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/maint-1.7.2-status-ignored' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 12 Sep 2011 04:51:10 +0000 (21:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Sep 2011 04:51:10 +0000 (21:51 -0700)
* jk/maint-1.7.2-status-ignored:
  git status --ignored: tests and docs
  status: fix bug with missing --ignore files

Conflicts:
Documentation/git-status.txt
t/t7508-status.sh

1  2 
Documentation/git-status.txt
t/t7508-status.sh
wt-status.c

index 4fca13d13408c2c82318fba2dd8a3468053c97c8,b663e5144480e915790ca592af3eccb270207dc9..3d51717bbe84d0201b1c7a38943b2e99643bd89f
@@@ -51,25 -42,16 +51,28 @@@ The possible options are
        - 'no'     - Show no untracked files
        - 'normal' - Shows untracked files and directories
        - 'all'    - Also shows individual files in untracked directories.
 ---
  +
 -See linkgit:git-config[1] for configuration variable
 -used to change the default for when the option is not
 -specified.
 +The default can be changed using the status.showUntrackedFiles
 +configuration variable documented in linkgit:git-config[1].
 +
 +--ignore-submodules[=<when>]::
 +      Ignore changes to submodules when looking for changes. <when> can be
 +      either "none", "untracked", "dirty" or "all", which is the default.
 +      Using "none" will consider the submodule modified when it either contains
 +      untracked or modified files or its HEAD differs from the commit recorded
 +      in the superproject and can be used to override any settings of the
 +      'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
 +      "untracked" is used submodules are not considered dirty when they only
 +      contain untracked content (but they are still scanned for modified
 +      content). Using "dirty" ignores all changes to the work tree of submodules,
 +      only changes to the commits stored in the superproject are shown (this was
 +      the behavior before 1.7.0). Using "all" hides all changes to submodules
 +      (and suppresses the output of submodule summaries when the config option
 +      `status.submodulesummary` is set).
  
+ --ignored::
+       Show ignored files as well.
  -z::
        Terminate entries with NUL, instead of LF.  This implies
        the `--porcelain` output format if no other format is given.
@@@ -95,32 -73,18 +98,33 @@@ In the short-format, the status of eac
  
        XY PATH1 -> PATH2
  
 -where `PATH1` is the path in the `HEAD`, and -> PATH2` part is
 +where `PATH1` is the path in the `HEAD`, and the ` \-> PATH2` part is
  shown only when `PATH1` corresponds to a different path in the
 -index/worktree (i.e. renamed).
 -
 -For unmerged entries, `X` shows the status of stage #2 (i.e. ours) and `Y`
 -shows the status of stage #3 (i.e. theirs).
 -
 -For entries that do not have conflicts, `X` shows the status of the index,
 -and `Y` shows the status of the work tree.  For untracked paths, `XY` are
 -`??`.
 -For ignored paths, `XY` are `!!`; they are shown only when the `--ignored`
 -option is in effect.
 +index/worktree (i.e. the file is renamed). The 'XY' is a two-letter
 +status code.
 +
 +The fields (including the `\->`) are separated from each other by a
 +single space. If a filename contains whitespace or other nonprintable
 +characters, that field will be quoted in the manner of a C string
 +literal: surrounded by ASCII double quote (34) characters, and with
 +interior special characters backslash-escaped.
 +
 +For paths with merge conflicts, `X` and 'Y' show the modification
 +states of each side of the merge. For paths that do not have merge
 +conflicts, `X` shows the status of the index, and `Y` shows the status
 +of the work tree.  For untracked paths, `XY` are `??`.  Other status
 +codes can be interpreted as follows:
 +
 +* ' ' = unmodified
 +* 'M' = modified
 +* 'A' = added
 +* 'D' = deleted
 +* 'R' = renamed
 +* 'C' = copied
 +* 'U' = updated but unmerged
 +
- Ignored files are not listed.
++Ignored files are not listed, unless `--ignored` option is in effect,
++in which case `XY` are `!!`.
  
      X          Y     Meaning
      -------------------------------------------------
      U           U    unmerged, both modified
      -------------------------------------------------
      ?           ?    untracked
+     !           !    ignored
      -------------------------------------------------
  
 +If -b is used the short-format status is preceded by a line
 +
 +## branchname tracking info
 +
 +Porcelain Format
 +~~~~~~~~~~~~~~~~
 +
 +The porcelain format is similar to the short format, but is guaranteed
 +not to change in a backwards-incompatible way between git versions or
 +based on user configuration. This makes it ideal for parsing by scripts.
 +The description of the short format above also describes the porcelain
 +format, with a few exceptions:
 +
 +1. The user's color.status configuration is not respected; color will
 +   always be off.
 +
 +2. The user's status.relativePaths configuration is not respected; paths
 +   shown will always be relative to the repository root.
 +
 +There is also an alternate -z format recommended for machine parsing. In
 +that format, the status field is the same, but some other things
 +change.  First, the '\->' is omitted from rename entries and the field
 +order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL
 +(ASCII 0) follows each filename, replacing space as a field separator
 +and the terminating newline (but a space still separates the status
 +field from the first filename).  Third, filenames containing special
 +characters are not specially formatted; no quoting or
 +backslash-escaping is performed. Fourth, there is no branch line.
  
  CONFIGURATION
  -------------
index 1fdfbd38654a83771f677f2219403e3713abef51,4856f9eeeaad1d0ffbf88b9371e664edf557119f..905255adf0ca5b15d9befa772cda4a650bd15f34
@@@ -131,31 -86,127 +131,152 @@@ test_expect_success 'status -s' 
  
  '
  
 -      # Changed but not updated:
+ test_expect_success 'status with gitignore' '
+       {
+               echo ".gitignore" &&
+               echo "expect" &&
+               echo "output" &&
+               echo "untracked"
+       } >.gitignore &&
+       cat >expect <<-\EOF &&
+        M dir1/modified
+       A  dir2/added
+       ?? dir2/modified
+       EOF
+       git status -s >output &&
+       test_cmp expect output &&
+       cat >expect <<-\EOF &&
+        M dir1/modified
+       A  dir2/added
+       ?? dir2/modified
+       !! .gitignore
+       !! dir1/untracked
+       !! dir2/untracked
+       !! expect
+       !! output
+       !! untracked
+       EOF
+       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
+       #
 -      # Changed but not updated:
++      # 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_cmp expect output
+ '
+ test_expect_success 'status with gitignore (nothing untracked)' '
+       {
+               echo ".gitignore" &&
+               echo "expect" &&
+               echo "dir2/modified" &&
+               echo "output" &&
+               echo "untracked"
+       } >.gitignore &&
+       cat >expect <<-\EOF &&
+        M dir1/modified
+       A  dir2/added
+       EOF
+       git status -s >output &&
+       test_cmp expect output &&
+       cat >expect <<-\EOF &&
+        M dir1/modified
+       A  dir2/added
+       !! .gitignore
+       !! dir1/untracked
+       !! dir2/modified
+       !! dir2/untracked
+       !! expect
+       !! output
+       !! untracked
+       EOF
+       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
+       git status --ignored >output &&
+       test_cmp expect output
+ '
+ rm -f .gitignore
 +cat >expect <<\EOF
 +## master
 + M dir1/modified
 +A  dir2/added
 +?? dir1/untracked
 +?? dir2/modified
 +?? dir2/untracked
 +?? expect
 +?? output
 +?? untracked
 +EOF
 +
 +test_expect_success 'status -s -b' '
 +
 +      git status -s -b >output &&
 +      test_cmp expect output
 +
 +'
 +
 +test_expect_success 'setup dir3' '
 +      mkdir dir3 &&
 +      : >dir3/untracked1 &&
 +      : >dir3/untracked2
 +'
 +
  cat >expect <<EOF
  # On branch master
  # Changes to be committed:
diff --cc wt-status.c
Simple merge