Skip to content

Commit

Permalink
Merge pull request #1 from xsuite/release/v0.0.1
Browse files Browse the repository at this point in the history
Release 0.0.1
  • Loading branch information
freddieknets authored Feb 23, 2024
2 parents 0910a07 + 2de180e commit d4277a5
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
46 changes: 46 additions & 0 deletions install_protection_hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# copyright ############################### #
# This file is part of the Xcoll Package. #
# Copyright (c) CERN, 2023. #
# ######################################### #


cat << 'EOF' > pre-commit
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]
then
echo "Cannot commit to main!"
echo "Use pull requests or, if package admin, the versioning script."
exit 1
fi
for file in pyproject.toml version.sh LICENSE install_protection_hook.sh xcoll/general.py
do
git diff --name-only | grep '^'${file}'$' &> /dev/null
if [ $? -eq 0 ]
then
thisfile=${file/.\*/\*}
echo "File $thisfile is protected but has local changes."
echo "Restore the file with 'git restore "${thisfile}"' before commiting anything,"
echo "or force this commit with 'git commit --no-verify'."
exit 1
fi
git diff --cached --name-only | grep '^'${file}'$' &> /dev/null
if [ $? -eq 0 ]
then
thisfile=${file/.\*/\*}
echo "File $thisfile is protected but has local changes that are staged."
echo "First unstage the file with 'git restore --staged "${thisfile}"', then "
echo "restore the file with 'git restore "${thisfile}"' before commiting anything."
echo "Alternatively, force this commit with 'git commit --no-verify'."
exit 1
fi
done
EOF

chmod +x pre-commit
mv pre-commit .git/hooks/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "xaux"
version = "0.0.0"
version = "0.0.1"
description = "Support tools for Xsuite packages"
authors = ["Frederik Van der Veken <[email protected]>"]
license = "Apache 2.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from xaux import __version__

def test_version():
assert __version__ == '0.0.0'
assert __version__ == '0.0.1'

2 changes: 1 addition & 1 deletion xaux/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
# ===================
# Do not change
# ===================
__version__ = '0.0.0'
__version__ = '0.0.1'
# ===================

0 comments on commit d4277a5

Please sign in to comment.