#!/bin/bash
# Setup a test git repository for e2e tests
# Usage: ./setup-test-repo.sh /tmp/test-repo

REPO_DIR="${1:-/tmp/lazygitclj-e2e-test}"

# Remove existing repo if present
rm -rf "$REPO_DIR"

# Create and initialize repo
mkdir -p "$REPO_DIR"
cd "$REPO_DIR"
git init -b main

# Configure git
git config user.email "test@example.com"
git config user.name "Test User"

# Create initial files
echo "# Test Project" > README.md
echo "line1" > file1.txt
echo "line2" > file2.txt
git add .
git commit -m "Initial commit"

# Create feature branch with changes
git checkout -b feature-branch
echo "feature content" > feature.txt
git add .
git commit -m "Add feature"

# Go back to main and make some uncommitted changes
git checkout main
echo "modified" >> file1.txt
echo "new file" > new-file.txt

echo "Test repo created at $REPO_DIR"
