devlog 7

I noticed I’m forgetting to update Xvc CHANGELOG. I added a pre-push hook to check the files I’m pushing and if CHANGELOG is not among them, it breaks the push. I hope this will help me to update the logs more often.

#!/bin/bash

# Get the current branch name

current_branch=$(git rev-parse --abbrev-ref HEAD)

# Check if the branch is develop

if [ "$current_branch" != "develop" ]; then
 echo "You are not on the develop branch. Skipping CHANGELOG.md check."
 exit 0
fi

# Get the list of commits to be pushed
commits=$(git rev-list @{u}..HEAD)

# Check if CHANGELOG.md is among the files in the commits
for commit in $commits; do
 if git diff-tree --no-commit-id --name-only -r $commit | grep -q "CHANGELOG.md"; then
  echo "CHANGELOG.md is included in the push."
  exit 0
 fi
done

echo "ERROR: CHANGELOG.md is not included in the push on the develop branch."
exit 1

/hooks/ /development/