rust/scripts/check-for-ignored
Paul Campbell b853a6acec
All checks were successful
/ test (map[name:nightly]) (push) Successful in 4s
/ test (map[name:stable]) (push) Successful in 5s
/ test (map[name:1.74.1]) (push) Successful in 5s
feat: add check-for-ignored script
Checks for ignored files that have been tracked by git.
2025-01-13 21:40:51 +00:00

30 lines
693 B
Bash
Executable file

#!/usr/bin/env bash
# Exit on error
set -e
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Error: git is not installed"
exit 1
fi
# Check if we're in a git repository
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
echo "Error: not in a git repository"
exit 1
fi
echo "Checking for tracked files that should be ignored..."
# Find files that are both tracked and ignored
ignored_files=$(git ls-files --cached -i --exclude-standard)
if [[ -z "$ignored_files" ]]; then
echo "No tracked files are marked as ignored"
exit 0
else
echo "The following tracked files are marked as ignored:"
echo "$ignored_files"
exit 1
fi