mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-17 20:56:24 +00:00
list-source-files: Process subdirectories correctly
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4475 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
list_source_files() {
|
||||
local r
|
||||
local d r
|
||||
|
||||
r="$1"
|
||||
d="$(cd "$1" && echo "$PWD")"
|
||||
r="$d"
|
||||
while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
|
||||
r="$(dirname "$r")"
|
||||
done
|
||||
|
||||
if [ -e "$r/.svn" ]; then
|
||||
(
|
||||
cd "$1"
|
||||
cd "$d"
|
||||
svn status -v | \
|
||||
grep -vE '^[D?]|^Performing|^$' | \
|
||||
cut -c41- | \
|
||||
@@ -21,20 +22,16 @@ list_source_files() {
|
||||
done
|
||||
)
|
||||
elif [ -e "$r/.git" ]; then
|
||||
git_dir="$PWD"
|
||||
while [ "$git_dir" != "" -a ! -e "$git_dir/.git" ]; do
|
||||
git_dir="$(dirname "$git_dir")"
|
||||
done
|
||||
subdir="${PWD#${git_dir}}"
|
||||
if [ "$git_dir" != "" ]; then
|
||||
git ls-tree --name-only -r HEAD | sed "s|^$subdir/||"
|
||||
subdir="${d#${r}}"
|
||||
if [ "$r" != "" ]; then
|
||||
( cd "$d" && git ls-tree --name-only -r HEAD ) | sed "s|^$subdir/||"
|
||||
else
|
||||
echo "Ignored directory $PWD" >&2
|
||||
echo "Ignored directory $1" >&2
|
||||
fi
|
||||
elif [ -e "$r/.hg" ]; then
|
||||
hg manifest
|
||||
else
|
||||
echo "Not under source control: $PWD ?" >&2
|
||||
echo "Not under source control: $1 ?" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user