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
35 rmf="echo Would remove"
36 rmrf="echo Would remove"
37 rm_refuse="echo Would not remove"
62 case "$ignored,$ignoredonly" in
66 if [ -z "$ignored" ]; then
67 excl="--exclude-per-directory=.gitignore"
68 if [ -f "$GIT_DIR/info/exclude" ]; then
69 excl_info="--exclude-from=$GIT_DIR/info/exclude"
71 if [ "$ignoredonly" ]; then
72 excl="$excl --ignored"
76 git-ls-files --others --directory $excl ${excl_info:+"$excl_info"} -- "$@" |
77 while read -r file; do
78 if [ -d "$file" -a ! -L "$file" ]; then
79 if [ -z "$cleandir" ]; then
83 $echo1 "Removing $file"
86 $echo1 "Removing $file"