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:
9
scripts/find-orphaned-versions.sh
Executable file
9
scripts/find-orphaned-versions.sh
Executable 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
15
scripts/install-repo-checks.sh
Executable 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
16
scripts/post-checkout
Executable 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
3
scripts/post-checkout.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
find . -name "*.~[1-9]*~" -exec if \[ ! -f {}:h \]\; then echo "{}" " with no versionless" \;
|
||||||
Reference in New Issue
Block a user