* [PATCH] cg-clean -d removes "arch" and "include" in Linux
@ 2005-09-13 22:04 Pavel Roskin
0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-09-13 22:04 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-09-13 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-13 22:04 [PATCH] cg-clean -d removes "arch" and "include" in Linux Pavel Roskin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).