chore: purge garbled Windows-path filenames; guard sync.sh against recurrence
Removed 5 tracked files whose names were mangled Windows paths (C:\ProgramData\..., D:\claudetools\.claude\current-mode, and version-bump script fragments) — the illegal :/\ chars were stored as Unicode Private-Use-Area substitutes (U+F03A, U+F00A). Added purge_garbled_paths() to sync.sh: before each 'git add -A', any UNTRACKED path containing control chars, ':', '\', or PUA U+E000-U+F8FF bytes is removed and not staged, so this cruft never reaches Gitea again. Tracked content is never auto-deleted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,30 @@ YELLOW='\033[1;33m'
|
|||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
|
# --- Guard: strip Windows path-as-filename cruft before staging -------------
|
||||||
|
# Windows machines occasionally drop files literally named like "C:\path" or
|
||||||
|
# ".claude\current-mode" into the repo. The illegal ':' / '\' chars get stored
|
||||||
|
# as Unicode Private-Use-Area substitutes (U+F03A, U+F00A, ...). A blind
|
||||||
|
# `git add -A` would stage and propagate them to Gitea. This removes any such
|
||||||
|
# UNTRACKED path before staging. Only untracked files are touched — tracked
|
||||||
|
# content is never auto-deleted (use `git rm` for that, deliberately).
|
||||||
|
purge_garbled_paths() {
|
||||||
|
local rec st p removed=0
|
||||||
|
while IFS= read -r -d '' rec; do
|
||||||
|
st="${rec:0:2}"
|
||||||
|
p="${rec:3}"
|
||||||
|
[ -z "$p" ] && continue
|
||||||
|
[ "$st" = "??" ] || continue # untracked only
|
||||||
|
if printf '%s' "$p" | LC_ALL=C grep -qaP '[\x00-\x1f\\:]|\xee[\x80-\xbf]|\xef[\x80-\xa3]'; then
|
||||||
|
echo -e "${YELLOW}[WARNING]${NC} Removing garbled untracked path before staging: $(printf '%s' "$p" | cat -v)"
|
||||||
|
rm -f -- "$p" 2>/dev/null || true
|
||||||
|
removed=1
|
||||||
|
fi
|
||||||
|
done < <(git status --porcelain -z)
|
||||||
|
[ "$removed" = 1 ] && echo -e "${YELLOW}[WARNING]${NC} Garbled Windows path-as-filename cruft removed (not synced)."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Machine + timestamp
|
# Machine + timestamp
|
||||||
if [ -n "$COMPUTERNAME" ]; then
|
if [ -n "$COMPUTERNAME" ]; then
|
||||||
MACHINE="$COMPUTERNAME"
|
MACHINE="$COMPUTERNAME"
|
||||||
@@ -100,6 +124,7 @@ if [ -n "$(git status --porcelain)" ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "${GREEN}[OK]${NC} Staging all changes..."
|
echo -e "${GREEN}[OK]${NC} Staging all changes..."
|
||||||
|
purge_garbled_paths
|
||||||
git add -A
|
git add -A
|
||||||
|
|
||||||
# Commit message (Co-Authored-By uses local git user if configured)
|
# Commit message (Co-Authored-By uses local git user if configured)
|
||||||
@@ -275,6 +300,7 @@ else
|
|||||||
# Commit any local vault changes (porcelain catches untracked-only too)
|
# Commit any local vault changes (porcelain catches untracked-only too)
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
echo -e "${YELLOW}[INFO]${NC} Local vault changes detected — committing..."
|
echo -e "${YELLOW}[INFO]${NC} Local vault changes detected — committing..."
|
||||||
|
purge_garbled_paths
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "sync: auto-sync vault from $MACHINE at $TIMESTAMP"
|
git commit -m "sync: auto-sync vault from $MACHINE at $TIMESTAMP"
|
||||||
echo -e "${GREEN}[OK]${NC} Vault committed."
|
echo -e "${GREEN}[OK]${NC} Vault committed."
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
dev
|
|
||||||
Reference in New Issue
Block a user