mql-check-binary-surprises/setup_git_repo.sh
2025-07-02 21:58:39 -07:00

32 lines
616 B
Bash

#!/bin/bash
# Check if the current directory is already a git repository
if [ -d ".git" ]; then
echo "Error: Git repository already exists."
exit 1
fi
# Create .gitignore file
cat <<EOL > .gitignore
*
!*.mqh
!*.mq5
!*.mq4
!*/
!**/*.mqh
!**/*.mq5
!**/*.mq4
EOL
# Initialize git repository
git init
# Add all files to the staging area
git add .
# Count how many files are in the index
file_count=$(git ls-files | wc -l)
echo "Number of files in the index: $file_count"
# Execute the command to check eolinfo for files in the index
git ls-files --format='%(eolinfo:index) %(path)' | column -t | grep '\-text'