3 # Copyright (c) 2005-2006 Pavel Roskin
6 USAGE="[-d] [-n] [-q] [-x | -X]"
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 as well'
22 rm_refuse="echo Not removing"
25 while case "$#" in 0) break ;; esac
33 rmf="echo Would remove"
34 rmrf="echo Would remove"
35 rm_refuse="echo Would not remove"
53 case "$ignored,$ignoredonly" in
57 if [ -z "$ignored" ]; then
58 excl="--exclude-per-directory=.gitignore"
59 if [ -f "$GIT_DIR/info/exclude" ]; then
60 excl_info="--exclude-from=$GIT_DIR/info/exclude"
62 if [ "$ignoredonly" ]; then
63 excl="$excl --ignored"
67 git-ls-files --others --directory $excl ${excl_info:+"$excl_info"} |
68 while read -r file; do
69 if [ -d "$file" -a ! -L "$file" ]; then
70 if [ -z "$cleandir" ]; then
74 $echo1 "Removing $file"
77 $echo1 "Removing $file"