23 lines
1.8 KiB
Bash
Executable File
23 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Does git status run a submodule's clean filter with --ignore-submodules=all vs =none,
|
|
# under checkout.mjs's SAFE flags and environment? Builds the bait fresh per mode.
|
|
set -u
|
|
B=$HOME/dewey-scratch/r91probe/w
|
|
SAFE=(-c core.hooksPath=/dev/null -c core.fsmonitor=false -c protocol.allow=never -c protocol.file.allow=always -c submodule.recurse=false)
|
|
E=(env -i PATH="$PATH" HOME=/nonexistent GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null GIT_TERMINAL_PROMPT=0 LC_ALL=C)
|
|
tg(){ "${E[@]}" git -c user.name=t -c user.email=[email protected] "$@"; }
|
|
for nested in 0 1; do for mode in all none; do
|
|
rm -rf "$B"; mkdir -p "$B"; M=$B/RAN
|
|
printf '#!/bin/sh\ntouch %s\ncat\n' "$M" > $B/run.sh; chmod +x $B/run.sh
|
|
tg init -q -b main $B/c; echo one > $B/c/README; tg -C $B/c add README; tg -C $B/c commit -q -m one
|
|
mk(){ tg init -q -b main $1; echo one > $1/data; echo 'data filter=x' > $1/.gitattributes; tg -C $1 add data .gitattributes; tg -C $1 commit -q -m s; tg -C $1 config filter.x.clean $B/run.sh; echo ONE > $1/data; }
|
|
if [ $nested = 0 ]; then mk $B/c/sub; tg -C $B/c update-index --add --cacheinfo 160000,$(tg -C $B/c/sub rev-parse HEAD),sub
|
|
else tg init -q -b main $B/c/sub; echo x > $B/c/sub/f; tg -C $B/c/sub add f; mk $B/c/sub/sub
|
|
tg -C $B/c/sub update-index --add --cacheinfo 160000,$(tg -C $B/c/sub/sub rev-parse HEAD),sub; tg -C $B/c/sub commit -q -m o
|
|
tg -C $B/c update-index --add --cacheinfo 160000,$(tg -C $B/c/sub rev-parse HEAD),sub; fi
|
|
rm -f $M
|
|
out=$("${E[@]}" git "${SAFE[@]}" --no-optional-locks --git-dir=$B/c/.git --work-tree=$B/c status --porcelain=v1 -z --untracked-files=all --ignore-submodules=$mode | tr '\0' '|'); rc=$?
|
|
echo "nested=$nested ignore=$mode rc=$rc marker=$([ -e $M ] && echo PRESENT || echo absent) status='$out'"
|
|
done; done
|
|
rm -rf "$B"
|