#!/bin/bash echo "=== Visual Branch Comparison ===" echo "" # Colors GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' echo "This script will show you exactly what's different between branches." echo "" # Check if we can access git if ! command -v git &> /dev/null; then echo "❌ Git not available" exit 1 fi # Show current state echo "📍 CURRENT STATE:" echo "Current branch: $(git branch --show-current 2>/dev/null || echo 'Unknown')" echo "Last commit: $(git log --oneline -1 2>/dev/null || echo 'Unknown')" echo "" # Show all branches echo "🌿 AVAILABLE BRANCHES:" git branch -a 2>/dev/null || echo "Could not get branches" echo "" # Function to show a simple timeline show_simple_timeline() { local branch=$1 local color=$2 echo "${color}📋 $branch TIMELINE:${NC}" echo "----------------------------------------" # Get last 5 commits with dates git log --oneline --date=short --pretty=format:"%h %ad %s" $branch 2>/dev/null | head -5 || echo "Could not get commits for $branch" echo "" } # Show timelines for each branch show_simple_timeline "main" "$GREEN" show_simple_timeline "master" "$BLUE" show_simple_timeline "origin/main" "$YELLOW" show_simple_timeline "origin/master" "$RED" echo "🔍 KEY DIFFERENCES:" echo "===================" # Show what's unique to each branch echo "" echo "📤 Commits ONLY in main (not in master):" git log --oneline main ^master 2>/dev/null | head -3 || echo "Could not compare" echo "" echo "📥 Commits ONLY in master (not in main):" git log --oneline master ^main 2>/dev/null | head -3 || echo "Could not compare" echo "" echo "🔧 SEARCHING FOR WORKING CODE:" echo "==============================" # Search for specific keywords in commit messages echo "" echo "🔍 Commits mentioning 'daemon' or 'D-Bus':" git log --oneline --grep="daemon\|D-Bus\|dbus" --all 2>/dev/null | head -5 || echo "None found" echo "" echo "🔍 Commits mentioning 'OCI' or 'bubblewrap':" git log --oneline --grep="OCI\|oci\|bubblewrap" --all 2>/dev/null | head -5 || echo "None found" echo "" echo "🔍 Commits mentioning 'fix' or 'working':" git log --oneline --grep="fix\|working" --all 2>/dev/null | head -5 || echo "None found" echo "" echo "📁 CHECKING CURRENT FILES:" echo "==========================" # Check current file state if [ -f "src/main.rs" ]; then if grep -q "// TODO: OCI image building not yet implemented" src/main.rs; then echo "❌ src/main.rs has BROKEN OCI implementation (commented out)" else echo "✅ src/main.rs has WORKING OCI implementation" fi else echo "❌ src/main.rs does not exist" fi if [ -f "src/bubblewrap_sandbox.rs" ]; then echo "✅ src/bubblewrap_sandbox.rs exists" else echo "❌ src/bubblewrap_sandbox.rs missing" fi if [ -f "src/oci.rs" ]; then echo "✅ src/oci.rs exists" else echo "❌ src/oci.rs missing" fi echo "" echo "🎯 RECOMMENDATIONS:" echo "==================" echo "" echo "1. Look at the timelines above - which branch has more recent commits?" echo "2. Check the 'KEY DIFFERENCES' section - which branch has unique commits?" echo "3. Look for commits mentioning 'daemon', 'OCI', or 'fix'" echo "4. If current files show 'BROKEN', you need to switch to a working commit" echo "" echo "To restore working code:" echo " git checkout # Switch to specific commit" echo " git checkout -b working # Create new branch from working commit" echo "" echo "The commit you want probably mentions 'daemon', 'D-Bus', 'OCI', or 'working'"