1
0
mirror of synced 2026-01-12 00:42:56 +00:00

Add a call to check for orphaned versions after any checkout (#1973)

* Add a call to check for orphaned versions after any checkout

* use == instead of -eq for optional

* Add a scripts/install-repo-checks for things to run after checkout; only this versioning error checked for now
This commit is contained in:
Larry Masinter 2025-01-25 11:15:27 -08:00 committed by GitHub
parent ef6a645bf5
commit 9f980276bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#/bin/sh
# $1 is a versioned file name
ver="$1"
base="${ver%%.~[1-9]*~}"
if [ ! -f "$base" ]; then
echo "Orphaned version: $ver but no $base"
fi

15
scripts/install-repo-checks.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# install checks for repository, meant to run post-checkout
# For now, this just checks for orphaned versions.
rm -f .git/hooks/post-checkout
cp scripts/post-checkout .git/hooks/post-checkout &&
chmod -x .git/hooks/post-checkout &&
echo copy made: &&
ls -l .git/hooks/post-checkout &&
exit 0
exit 1

16
scripts/post-checkout Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Get the parameters
previous_head=$1
new_head=$2
is_branch_checkout=$3
# Print some info
echo "Checkout complete!"
# echo "Previous HEAD: $previous_head"
# echo "New HEAD: $new_head"
# echo "Branch checkout: $is_branch_checkout"
if [[ "$is_branch_checkout" == "1" ]]; then
find . -name "*.~[1-9]*~" -exec ./scripts/find-orphaned-versions.sh {} \;
fi

3
scripts/post-checkout.sh Executable file
View File

@ -0,0 +1,3 @@
#/bin/sh
find . -name "*.~[1-9]*~" -exec if \[ ! -f {}:h \]\; then echo "{}" " with no versionless" \;