Re: [PATCH 2/4] completion: introduce __gitcomp_2 ()
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jan 3, 2014, 07:51 UTC
- Message-ID
- <CALkWK0mgqJFz1Lf_UVX8fdvnT+u+rp705dak7kXVFFBSr2bTQA@mail.gmail.com>
- In-Reply-To
- <xmqqeh4qndxs.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
> __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "." > __gitcomp_nl_append $"autosetupmerge\nautosetuprebase\n" "$pfx" "$cur_" " "
This is not a bad idea at all. I'm just afraid that we might be leaving open ends: What happens if the $pfx isn't the same in both cases? Who keeps track of the index "i" of COMPREPLY (it's currently a local variable)? If we make it global, doesn't every function that deals with COMPREPLY be careful to reset it?
More importantly, can you see a usecase for more than two completion classes?