Skip to content

Commit 691e743

Browse files
committed
git-extra: avoid forcing LDAP query by editing nsswitch.conf
With certain nsswitch.conf settings, Cygwin/MSys2 is forced to query the ActiveDirectory (LDAP). By commenting out those settings, we avoid that. As reported by Jeremy Kolb, this query can lead to dozens of seconds delay upon starting the Git Bash. This fixes git-for-windows/git#193. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 56dcda4 commit 691e743

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

git-extra/git-extra.install.in

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ GITCONFIG
1111
done
1212

1313
grep -q '^db_home: env windows' /etc/nsswitch.conf ||
14-
sed -i 's/^\(db_\(home\|shell\|gecos\): \)\(windows \)\?\([^w]\)/\1env windows \4/' \
14+
sed -i 's/^\(db_home: \)\(windows \)\?\([^w]\)/\1env windows \3/' \
15+
/etc/nsswitch.conf
16+
17+
! grep -q '^db_shell: [^#]*cygwin' /etc/nsswitch.conf ||
18+
sed -i 's/^\(db_shell: \)\(env \)\?\(windows \)\?/\1env windows # /' \
19+
/etc/nsswitch.conf
20+
21+
! grep -q '^db_gecos: [^#]*\(cygwin\|windows\)' /etc/nsswitch.conf ||
22+
sed -i 's/^\(db_gecos: \)\(env \)\?\([^e]\)/\1env # \3/' \
1523
/etc/nsswitch.conf
1624

1725
! grep -q '^PS1=' /etc/bash.bashrc ||

0 commit comments

Comments
 (0)