Created
February 23, 2026 13:08
-
-
Save pmatos/2ef30b3d7fe808546cd8cdf84abe7fde to your computer and use it in GitHub Desktop.
Patch issue with worktrees
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| EXPECTED_SHA="74042739197c58a4791c1f67414c0d8956639ec2f2e935280872b83d4317be78" | |
| PATCHED_SHA="f098915988a2ac5a5747334147e4893bbca94eacd02bb36ee4c0e7d8f6df1c74" | |
| TARGET="${1:-$(readlink -f "$(which claude)")}" | |
| if [[ ! -f "$TARGET" ]]; then | |
| echo "Error: file not found: $TARGET" >&2 | |
| exit 1 | |
| fi | |
| ACTUAL_SHA=$(sha256sum "$TARGET" | awk '{print $1}') | |
| if [[ "$ACTUAL_SHA" == "$PATCHED_SHA" ]]; then | |
| echo "Already patched: $TARGET" | |
| exit 0 | |
| fi | |
| if [[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]]; then | |
| echo "Error: SHA256 mismatch for $TARGET" >&2 | |
| echo " Expected: $EXPECTED_SHA" >&2 | |
| echo " Got: $ACTUAL_SHA" >&2 | |
| echo "This script only patches Claude Code v2.1.50 (unpatched)." >&2 | |
| exit 1 | |
| fi | |
| cp "$TARGET" "$TARGET.bak" | |
| sed -i 's/tengu_worktree_mode",!1/tengu_worktree_mode",!0/g' "$TARGET" | |
| NEW_SHA=$(sha256sum "$TARGET" | awk '{print $1}') | |
| if [[ "$NEW_SHA" != "$PATCHED_SHA" ]]; then | |
| echo "Error: unexpected SHA after patching, restoring backup" >&2 | |
| mv "$TARGET.bak" "$TARGET" | |
| exit 1 | |
| fi | |
| echo "Patched: $TARGET" | |
| echo "Backup: $TARGET.bak" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment