@matheusbsbs / matheus-bagliano / commits / 443f8338b9
Fork 0

git status: skip empty directories, and add -u to show all untracked files

By default, we use --others --directory to show uninteresting directories (to get user's attention) without their contents (to unclutter output). Showing empty directories do not make sense, so pass --no-empty-directory when we do so. Giving -u (or --untracked) disables this uncluttering to let the user get all untracked files. Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Lederhofer committed May 22, 2006 at 23:02 UTC 443f8338b9e248353a7095a1096684f1ed106c66
1 file changed +14 -3
git-commit.sh
+14 -3
@@ -3,7 +3,7 @@
3 # Copyright (c) 2005 Linus Torvalds
4 # Copyright (c) 2006 Junio C Hamano
5
6 -USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>) [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
6 +USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-u] [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
7 SUBDIRECTORY_OK=Yes
8 . git-sh-setup
9
@@ -134,13 +134,17 @@ run_status () {
134 report "Changed but not updated" \
135 "use git-update-index to mark for commit"
136
137 + option=""
138 + if test -z "$untracked_files"; then
139 + option="--directory --no-empty-directory"
140 + fi
141 if test -f "$GIT_DIR/info/exclude"
142 then
139 - git-ls-files -z --others --directory \
143 + git-ls-files -z --others $option \
144 --exclude-from="$GIT_DIR/info/exclude" \
145 --exclude-per-directory=.gitignore
146 else
143 - git-ls-files -z --others --directory \
147 + git-ls-files -z --others $option \
148 --exclude-per-directory=.gitignore
149 fi |
150 perl -e '$/ = "\0";
@@ -203,6 +207,7 @@ verbose=
207 signoff=
208 force_author=
209 only_include_assumed=
210 +untracked_files=
211 while case "$#" in 0) break;; esac
212 do
213 case "$1" in
@@ -340,6 +345,12 @@ do
345 verbose=t
346 shift
347 ;;
348 + -u|--u|--un|--unt|--untr|--untra|--untrac|--untrack|--untracke|--untracked|\
349 + --untracked-|--untracked-f|--untracked-fi|--untracked-fil|--untracked-file|\
350 + --untracked-files)
351 + untracked_files=t
352 + shift
353 + ;;
354 --)
355 shift
356 break