Skip to content

Commit 269b2f6

Browse files
committed
fix: Improve git status check with timeout for large repositories
1 parent e6434b1 commit 269b2f6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

services/devtools/entrypoint.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,19 @@ if [ -t 0 ] && [ "$1" = "/bin/bash" ]; then
5858
echo -e "${CYAN}Repository:${NC} $REPO"
5959
echo -e "${CYAN}Branch:${NC} $BRANCH"
6060

61-
# Kurzer Status
62-
CHANGES=$(git status --porcelain 2>/dev/null | wc -l)
63-
if [ "$CHANGES" -gt 0 ]; then
64-
echo -e "${YELLOW}Changes:${NC} $CHANGES uncommitted file(s)"
61+
# Kurzer Status (mit Timeout für große Repos)
62+
if CHANGES=$(timeout 3 git status --porcelain 2>/dev/null | head -100 | wc -l); then
63+
if [ "$CHANGES" -gt 0 ]; then
64+
if [ "$CHANGES" -ge 100 ]; then
65+
echo -e "${YELLOW}Changes:${NC} 100+ uncommitted file(s)"
66+
else
67+
echo -e "${YELLOW}Changes:${NC} $CHANGES uncommitted file(s)"
68+
fi
69+
else
70+
echo -e "${GREEN}Changes:${NC} Working tree clean"
71+
fi
6572
else
66-
echo -e "${GREEN}Changes:${NC} Working tree clean"
73+
echo -e "${YELLOW}Changes:${NC} (skipped - large repo)"
6774
fi
6875
echo ""
6976
fi

0 commit comments

Comments
 (0)