scm.sh ls-files: Honor -f in Git repositories

In CVS, the -f option keeps directory entries out of scm.sh ls-file's
listing; in Git, it's a silent no-op. Notably symlinks are not excluded
despite -f.

Implement -f for git with a mode filter on git ls-files -s output: only
100644 and 100755 entries are listed, so the option means the same thing in
both code paths.

For Git, this actually means a behaviour change which needs to be fixed:

The dist archive targets tar-files and cpio-files in make/list-files.mk and
the scm_files() helper in scripts/pkg.sh then may no longer pass it to get
unchanged behaviour.

The targets list-files and list-text-files keep it, so the text-files cache
now matches its documented regular-files-only membership.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-09-16 12:19:18 +02:00
commit 7cec102691
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
4 changed files with 15 additions and 5 deletions

View file

@ -101,7 +101,7 @@ scm_files()
{
(
cd $TOPDIR
/bin/bash $JWB_SCRIPT_DIR/scm.sh ls-files -f "$@"
/bin/bash $JWB_SCRIPT_DIR/scm.sh ls-files "$@"
)
}

View file

@ -121,7 +121,17 @@ cmd_ls_files()
local opts="$git_ls_files_opts"
git --version | grep -q "version *1" && opt_no_submodules=1
[ "$opt_no_submodules" = 1 ] || opts="$opts --recurse-submodules"
git ls-files --recurse-submodules $opts $1
if [ "$opt_only_regular_files" != 1 ]; then
git ls-files --recurse-submodules $opts $1
else
local entry meta
while IFS= read -r -d '' entry; do
meta=${entry%%$'\t'*}
case ${meta%% *} in
100644|100755) output "${entry#*$'\t'}" ;;
esac
done < <(git ls-files -s -z --recurse-submodules $opts $1)
fi
if [ "$include_vcs_files" = 1 -a -d .git ]; then
output_find .git
fi