3 # Copyright (c) 2005-2006 Pavel Roskin
6 USAGE
="[-d] [-n] [-q] [-x | -X] [--] <paths>..."
7 LONG_USAGE
='Clean untracked files from the working directory
8 -d remove directories as well
9 -n don'\''t remove anything, just show what would be done
10 -q be quiet, only report errors
11 -x remove ignored files as well
12 -X remove only ignored files
13 When optional <paths>... arguments are given, the paths
14 affected are further limited to those that match them.'
24 rm_refuse
="echo Not removing"
27 while case "$#" in 0) break ;; esac
34 rmf
="echo Would remove"
35 rmrf
="echo Would remove"
36 rm_refuse
="echo Would not remove"
61 case "$ignored,$ignoredonly" in
65 if [ -z "$ignored" ]; then
66 excl
="--exclude-per-directory=.gitignore"
67 if [ -f "$GIT_DIR/info/exclude" ]; then
68 excl_info
="--exclude-from=$GIT_DIR/info/exclude"
70 if [ "$ignoredonly" ]; then
71 excl
="$excl --ignored"
75 git-ls-files
--others --directory $excl ${excl_info:+"$excl_info"} -- "$@" |
76 while read -r file; do
77 if [ -d "$file" -a ! -L "$file" ]; then
78 if [ -z "$cleandir" ]; then
82 $echo1 "Removing $file"
85 $echo1 "Removing $file"