diff options
Diffstat (limited to 'docs')
| -rwxr-xr-x | docs/how-to/migration-scripts/10-check-git-sync.sh | 15 | ||||
| -rwxr-xr-x | docs/how-to/migration-scripts/run-migration-analysis.sh | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/docs/how-to/migration-scripts/10-check-git-sync.sh b/docs/how-to/migration-scripts/10-check-git-sync.sh index 1f2ce04..b4536cb 100755 --- a/docs/how-to/migration-scripts/10-check-git-sync.sh +++ b/docs/how-to/migration-scripts/10-check-git-sync.sh | |||
| @@ -118,6 +118,11 @@ usage() { | |||
| 118 | check_prerequisites() { | 118 | check_prerequisites() { |
| 119 | local missing=0 | 119 | local missing=0 |
| 120 | 120 | ||
| 121 | if ! command -v git &> /dev/null; then | ||
| 122 | log_error "git not found. Install with your package manager." | ||
| 123 | missing=1 | ||
| 124 | fi | ||
| 125 | |||
| 121 | if ! command -v nak &> /dev/null; then | 126 | if ! command -v nak &> /dev/null; then |
| 122 | log_error "nak not found. Install from: https://github.com/fiatjaf/nak" | 127 | log_error "nak not found. Install from: https://github.com/fiatjaf/nak" |
| 123 | log_error "Or run: nix-shell -p nak jq --run \"$0 $*\"" | 128 | log_error "Or run: nix-shell -p nak jq --run \"$0 $*\"" |
| @@ -161,13 +166,15 @@ count_git_refs() { | |||
| 161 | return | 166 | return |
| 162 | fi | 167 | fi |
| 163 | 168 | ||
| 164 | # Use git show-ref to handle both packed and loose refs | 169 | # Try git show-ref first (handles packed refs correctly) |
| 165 | # Fall back to counting loose refs if git show-ref fails | 170 | # Note: We capture output separately to avoid pipefail issues |
| 166 | if git --git-dir="$git_dir" show-ref --heads 2>/dev/null | wc -l | tr -d ' '; then | 171 | local count |
| 172 | if count=$(git --git-dir="$git_dir" show-ref --heads 2>/dev/null | wc -l); then | ||
| 173 | echo "$count" | tr -d ' ' | ||
| 167 | return | 174 | return |
| 168 | fi | 175 | fi |
| 169 | 176 | ||
| 170 | # Fallback: count loose refs | 177 | # Fallback: count loose refs (when git is not available or fails) |
| 171 | if [[ -d "$git_dir/refs/heads" ]]; then | 178 | if [[ -d "$git_dir/refs/heads" ]]; then |
| 172 | find "$git_dir/refs/heads" -type f 2>/dev/null | wc -l | tr -d ' ' | 179 | find "$git_dir/refs/heads" -type f 2>/dev/null | wc -l | tr -d ' ' |
| 173 | else | 180 | else |
diff --git a/docs/how-to/migration-scripts/run-migration-analysis.sh b/docs/how-to/migration-scripts/run-migration-analysis.sh index 84aec2a..65d9d17 100755 --- a/docs/how-to/migration-scripts/run-migration-analysis.sh +++ b/docs/how-to/migration-scripts/run-migration-analysis.sh | |||
| @@ -155,7 +155,7 @@ FROM_PHASE="" | |||
| 155 | declare -A PHASE_TIMES | 155 | declare -A PHASE_TIMES |
| 156 | 156 | ||
| 157 | usage() { | 157 | usage() { |
| 158 | head -80 "$0" | tail -n +3 | sed 's/^# //' | sed 's/^#//' | 158 | head -73 "$0" | tail -n +3 | sed 's/^# //' | sed 's/^#//' |
| 159 | exit 0 | 159 | exit 0 |
| 160 | } | 160 | } |
| 161 | 161 | ||
| @@ -285,7 +285,7 @@ check_prerequisites() { | |||
| 285 | log_info "Checking prerequisites..." | 285 | log_info "Checking prerequisites..." |
| 286 | 286 | ||
| 287 | # Required tools | 287 | # Required tools |
| 288 | for tool in nak jq awk sort; do | 288 | for tool in git nak jq awk sort; do |
| 289 | if command -v "$tool" &> /dev/null; then | 289 | if command -v "$tool" &> /dev/null; then |
| 290 | log_step "$tool: found" | 290 | log_step "$tool: found" |
| 291 | else | 291 | else |