git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cg-clean fails on files beginning with a dash

From
DSDennis Stosberg <dennis@stosberg.net>
Date
May 29, 2006, 15:06 UTC
Message-ID
<20060529150652.G6dba4ec3@leonov.stosberg.net>
Reproducible with:

$ git init-db $ echo "some text" >-file $ cg clean Removing -file rm: invalid option -- l Try `rm --help' for more information.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 cg-clean |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cg-clean b/cg-clean
index 5f438eb..fe611ac 100755
--- a/cg-clean
+++ b/cg-clean
@@ -67,13 +67,13 @@ while read -r file; do
 		if [ "$cleandirhard" ]; then
 			chmod -R 700 "$file"
 		fi
-		$rm -rf "$file"
+		$rm -rf -- "$file"
 		if [ -e "$file" -o -L "$file" ]; then
 			echo "Cannot remove $file"
 		fi
 	elif [ -e "$file" -o -L "$file" ]; then
 		[ "$quiet" ] || echo "Removing $file"
-		"$rm" -f "$file"
+		"$rm" -f -- "$file"
 		# rm would complain itself on failure
 	else
 		echo "File $file has disappeared!"
-- 
1.3.3+git20060528-dest1
Message 1 of 1 in “cg-clean fails on files beginning with a dash”
  1. cg-clean fails on files beginning with a dashDennis Stosberg, May 29, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.