Re: [PATCH 07/19] completion: make __gitdir() store repository path in $__git_dir
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 9, 2012, 19:36 UTC
- Message-ID
- <7vehqtrvt8.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1336524290-30023-8-git-send-email-szeder@ira.uka.de>
SZEDER Gábor <szeder@ira.uka.de> 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.