# [PATCH]: cg-clean confused by symlinks to directories

1 messages from 2005-09-23 to 2005-09-23. Participants: Pavel Roskin.
Thread: https://gitlist.dev/t/1927

## Pavel Roskin, 2005-09-23 22:12

Subject: [PATCH]: cg-clean confused by symlinks to directories
Message-ID: <1127513570.4708.4.camel@dv>
URL: https://gitlist.dev/e/1127513570.4708.4.camel%40dv

```
cg-clean confused by symlinks to directories

It turns out that "git-ls-files --others" shows symlinks to directories.
That shouldn't trigger internal error in cg-clean.  Such symlinks should
be treated like files and removed even without the "-d" option.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cg-clean b/cg-clean
--- a/cg-clean
+++ b/cg-clean
@@ -111,7 +111,7 @@ clean_files()
 	cg-status "$xopt" -w | sed -n 's/^? //p' |
 	for file in $(cat); do
 		path="${_git_relpath}$file"
-		if [ -d "$path" ]; then
+		if [ -d "$path" -a ! -L "$path" ]; then
 			# Sanity check, shouldn't happen
 			echo "FATAL: cg-status reports directories (internal error)" >&2
 			exit 1


-- 
Regards,
Pavel Roskin

```
