scripts/list-source-files: Improve robustness of this script

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7343 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-01-22 03:44:33 +00:00
parent f2a00f8e73
commit 397511514a
+8 -12
View File
@@ -1,29 +1,25 @@
#!/bin/bash
inode() {
ls -id "$1" | { read a b; echo "$a"; }
}
list_source_files() {
local d r
d="$(cd "$1" && echo "$PWD")"
r="$d"
inode_root="$(inode /)"
while [ $(inode "$r") != "${inode_root}" -a \
! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
r="$r/.."
while [ "$r" != "/" ] && [ ! -e "$r/.svn" ] && [ ! -e "$r/.git" ] &&
[ ! -e "$r/.hg" ]; do
r="$(dirname "$r")"
done
if [ -e "$r/.svn" ]; then
(
cd "$d"
cd "$d" || exit $?
svn status -v | \
grep -vE '^[D?]|^Performing|^$' | \
cut -c41- | \
while read f; do
cut -c3- | \
while read -r a b c f; do
if [ -f "$f" ]; then
echo "$f"
echo "$a $b $c" >/dev/null
echo "$f"
fi
done
)