Files
scst/scripts/list-source-files
T
Gleb Chesnokov 1a1a75d9ed scripts: Remove non-Git VCS support
Mercurial branches remain in source-listing and cleanup helpers after
Subversion support was retired. SCST development now uses Git.

Remove Mercurial detection and commands together with stale Subversion
wording. Preserve the existing no-VCS source-list fallback and all Git
behavior.
2026-08-21 19:58:59 +03:00

58 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
list_source_files() {
local d r
d="$(cd "$1" && echo "$PWD")"
r="$d"
while [ "$r" != "/" ] && [ ! -e "$r/.git" ]; do
r="$(dirname "$r")"
done
if [ -e "$r/.git" ]; then
subdir="${d#"${r}"}"
if [ "$r" != "" ]; then
( cd "$d" && git ls-tree --name-only -r HEAD ) | sed "s|^$subdir/||"
else
echo "Ignored directory $1" >&2
fi
else
(
cd "$d" &&
find . -type f -o -type l |
sed -e 's/^\.\///' \
-e '/\.depend_\(adm\|d\|f\)$/d' \
-e '/\.o$/d' \
-e '/\.o\.d$/d' \
-e '/\.o\.cmd$/d' \
-e '/\.ko$/d' \
-e '/\.ko\.cmd$/d' \
-e '/\.mod$/d' \
-e '/\.mod\.c$/d' \
-e '/\.mod\.cmd$/d' \
-e '/\/Module\.\(symver\|marker\)s$/d' \
-e '/\/\.Module\.symvers\.cmd$/d' \
-e '/\/\.modules\.order\.cmd$/d' \
-e '/\/\.tmp_versions\(\/\|$\)/d' \
-e '/\/blib\//d' \
-e '/\/conftest\/.*\/build-output-.*\.txt$/d' \
-e '/\/conftest\/.*\/result-.*\.txt$/d' \
-e '/\/modules\.order$/d' \
-e '/\/rpmbuilddir\//d' \
-e '/^iscsi-scst\/usr\/iscsi-scst-adm$/d' \
-e '/^iscsi-scst\/usr\/iscsi-scstd$/d' \
-e '/^rpmbuilddir\//d' \
-e '/^usr\/fileio\/fileio_tgt$/d' \
-e '/^usr\/stpgd\/stpgd$/d' \
-e '/debian\/tmp\//d' \
-e '/~$/d'
)
fi | sort
}
if [ $# = 0 ]; then
list_source_files "$PWD"
else
for d in "$@"; do list_source_files "$d"; done
fi