From: Junio C Hamano Date: Wed, 09 May 2012 19:36:19 GMT Subject: Re: [PATCH 07/19] completion: make __gitdir() store repository path in $__git_dir Message-ID: <7vehqtrvt8.fsf@alter.siamese.dyndns.org> In-Reply-To: <1336524290-30023-8-git-send-email-szeder@ira.uka.de> SZEDER Gábor writes: > Also declare $__git_dir as local in __git_ps1() and _gitk() to prevent > the variable from leaking into the environment when they call > __gitdir() (that would break completion and bash prompt when the user > moves to a different git repository). Good; this was actually the only major thing I worried about when I saw the tail part of the series. So $__git_dir is global across the call chain of a single invocation to show __git_ps1, but it always is reset once __git_ps1 is called again, so that it will always know where the then-current git repository is, right? Looks quite a sane and valid optimization to me.