fix: align Git Bash shell config handling

This commit is contained in:
Sundaram Kumar Jha
2026-03-28 23:37:53 +05:30
parent c3c3075610
commit 0f42c8c8c1
2 changed files with 55 additions and 26 deletions
+12 -1
View File
@@ -673,7 +673,18 @@ detect_shell_rc() {
fi
;;
bash)
if [ -f "$HOME/.bashrc" ]; then
# Git Bash on Windows commonly starts as a login shell, so prefer
# .bash_profile there when it already exists. On Unix-like shells,
# keep the traditional .bashrc-first behavior.
if [ -n "$MSYSTEM" ] || [ -n "$MINGW_PREFIX" ]; then
if [ -f "$HOME/.bash_profile" ]; then
echo "$HOME/.bash_profile"
elif [ -f "$HOME/.bashrc" ]; then
echo "$HOME/.bashrc"
else
echo "$HOME/.profile"
fi
elif [ -f "$HOME/.bashrc" ]; then
echo "$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
echo "$HOME/.bash_profile"