Files
lazygitclj/test/e2e/setup-test-repo.sh
2026-01-21 17:49:39 -05:00

48 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Setup a test git repository for e2e testing
set -e
TEST_REPO="${1:-/tmp/lazygitclj-test-repo}"
# Clean up if exists
rm -rf "$TEST_REPO"
mkdir -p "$TEST_REPO"
cd "$TEST_REPO"
# Initialize git repo
git init -b main
git config user.email "test@example.com"
git config user.name "Test User"
# Create initial files and commit
echo "# Test Project" > README.md
echo "line1" > file1.txt
echo "line1" > file2.txt
git add .
git commit -m "Initial commit"
# Create a feature branch
git checkout -b feature-branch
echo "feature work" >> file1.txt
git add .
git commit -m "Feature work"
git checkout main
# Create some unstaged changes
echo "modified" >> file1.txt
# Create untracked file
echo "new file content" > newfile.txt
# Stage one file
echo "staged content" >> file2.txt
git add file2.txt
echo "Test repo created at $TEST_REPO"
echo " - main branch with 1 commit"
echo " - feature-branch with 1 extra commit"
echo " - 1 staged file (file2.txt)"
echo " - 1 unstaged file (file1.txt)"
echo " - 1 untracked file (newfile.txt)"