Re: [PATCH 2/2] completion: split __git_ps1 into a separate script
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- May 23, 2012, 20:50 UTC
- Message-ID
- <CAMP44s3uW75O_jt2F7POxTAhX+qPyRSjOX9-DuEkg7a7WtnLsA@mail.gmail.com>
- In-Reply-To
- <CAOnadRF8XyZKi+d=y1fFy2Xvs-3ETVyCbJBj83mK3Q8yuK7oQw@mail.gmail.com>
On Wed, May 23, 2012 at 7:03 PM, Ted Pavlic <ted@tedpavlic.com> wrote:
Show 16 quoted lines
>>> I am not sure if that is worth it. These two share/duplicate some shell >>> functions and we may end up refactoring them (a way to do so may be to >>> dot-source git-prompt from git-completion and drop duplicated definitions >>> from the latter), for example. >> >> And how do you propose to update the install documentation? >> >> 1) Copy the file (e.g. ~/.git-completion.sh) >> 2) Copy the other file (.e.g ~/.git-prompt.sh) >> 3) Edit the original file (~/.git-completion.sh), modify the 'source' >> command to use the other file (~/.git-prompt.sh) > > The third step doesn't seem necessary if .git-completion sources > git-prompt when it's available (and otherwise ignores it gracefully). > Then anyone who cares about the prompt just makes sure that git-prompt > is available.
And then anything that uses __gitdir() would fail.
And how would you figure if it's available, and where it is available? What if git-completion.bash is distributed on /usr/share/bash-completion/completions/git? Where would you put git-prompt.sh so it can be found *and* you would not require modifications? And what if I want to put the latest version on ~/.git-completion.sh (as the script actually suggests).
There's no way git-prompt.sh can be sourced without modifications to the script, unless you expect it would always be named '.git-prompt.sh' and would be on the same directory, which many distributions would frown upon.
-- Felipe Contreras