fix(memory): partial-stage check sorts and compares in the C locale

uutils sort collates by locale while uutils comm expects byte order: comm warned and could miss a dropped partial stage. Both now run with LC_ALL=C.
This commit is contained in:
bchanot committed 2026-11-08 19:49:26 +01:00
1 parent f1332d85e3
commit 54bdfebd06
2 files changed
+24 -3

No files matched your search

+5 -3
View File
@@ -59,9 +59,11 @@ _partial_stages() {
read -r mode oid _ < <(git ls-files -s -- "$p")
echo "memory-commit: partial stage dropped on: $p (blob $oid;" \
"restore: git update-index --cacheinfo $mode,$oid,$p)"
done < <(comm -12 \
<(git -c core.quotepath=off diff --cached --name-only -- "$@" | sort) \
<(git -c core.quotepath=off diff --name-only -- "$@" | sort))
# C locale for both: a locale sort and a byte-order comm disagree (uutils)
done < <(LC_ALL=C comm -12 \
<(git -c core.quotepath=off diff --cached --name-only -- "$@" \
| LC_ALL=C sort) \
<(git -c core.quotepath=off diff --name-only -- "$@" | LC_ALL=C sort))
}
# Surgical commit of the scoped paths only. Returns 0 (ok or no-op), 3 (unsafe).