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

[PATCH] cg-clean -d removes "arch" and "include" in Linux

From
PRPavel Roskin <proski@gnu.org>
Date
Sep 13, 2005, 22:04 UTC
Message-ID
<1126649075.28384.15.camel@dv>
Hello!

"cg-clean -d" would delete directories that don't have versioned files in them, even if their subdirectories do. "arch" and "include" in Linux sources are such directories.

To be safe, every directory in the directory list should be complemented by all its parent directories.

The patch below is a quick hack that shows that bash is not the best language to implement this. Still, it's better to have such fix than having cg-clean remove source files.

Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/cg-clean b/cg-clean
--- a/cg-clean
+++ b/cg-clean
@@ -53,6 +53,18 @@ clean_dirs()
 	git-ls-files --cached |
 		sed -n 's|^'"$_git_relpath"'||p' |
 		sed -n 's|/[^/]*$||p' |
+		while IFS='/' read -a dir; do
+			i=0
+			while test $i != ${#dir[@]}; do
+				j=0
+				while test $i != $j; do
+					echo -n ${dir[$j]}/
+					j=$[$j+1]
+				done
+				echo ${dir[$i]}
+				i=$[$i+1]
+			done
+		done |
 		sort -u >"$dirlist"
 
 	save_IFS="$IFS"
-- 
Regards,
Pavel Roskin
Message 1 of 1 in “cg-clean -d removes "arch" and "include" in Linux”
  1. cg-clean -d removes "arch" and "include" in LinuxPavel Roskin, Sep 13, 2005

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.