Optimized scripts/review_working_trees.py by consolidating multiple Git
subprocess calls into bulk metadata retrieval.
Key improvements:
- Implemented populate_metadata_cache() using `git for-each-ref`.
- Used `%(ahead-behind:origin/main)` for efficient unpushed commits detection.
- Used `%(HEAD)` to identify the current branch, eliminating an extra subprocess call.
- Consolidated `git status --short` and `git status -sb` into a single call.
- Added fallback logic for Git versions older than 2.41.0.
- Fixed a bug where the current branch marker was incorrectly applied.
Performance impact: Reduces Git subprocess calls from ~8 to ~4.
Verification: Verified consistent output and performance with `time`.