From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: git-completion with bash alias Date: Fri, 18 May 2012 20:41:47 -0400 Message-ID: <20120519004147.GE765@sigill.intra.peff.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Felipe Contreras , git@vger.kernel.org To: Carsten Mattner X-From: git-owner@vger.kernel.org Sat May 19 02:41:57 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SVXk4-0004Og-Lo for gcvg-git-2@plane.gmane.org; Sat, 19 May 2012 02:41:56 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965128Ab2ESAlw (ORCPT ); Fri, 18 May 2012 20:41:52 -0400 Received: from 99-108-226-0.lightspeed.iplsin.sbcglobal.net ([99.108.226.0]:48900 "EHLO peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964782Ab2ESAlv (ORCPT ); Fri, 18 May 2012 20:41:51 -0400 Received: (qmail 10078 invoked by uid 107); 19 May 2012 00:42:14 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) (smtp-auth username relayok, mechanism cram-md5) by peff.net (qpsmtpd/0.84) with ESMTPA; Fri, 18 May 2012 20:42:14 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Fri, 18 May 2012 20:41:47 -0400 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote: > Completion works when used as "git checkout foo" but fails with > "bash: [: 1: unary operator expected" when trying to complete > via a single character shell alias like "alias g=git" as in > "g checkout foo". > > git version 1.7.10.2.548.g9de9681 Hmm. Are you invoking the completion like: complete -F _git g ? That used to work, but was broken by the recent 6b179ad (completion: add new __git_complete helper, 2012-05-14). The "new" way seems to be: __git_complete g _git but that function is explicitly labeled as "not public". It looks like there was a follow-on patch that was discussed to make a public version, but it got dropped. I'm not sure if this regression is intentional, or if the "old" way even worked reliably (I seem to recall people running into issues with _get_comp_words_by_ref not being called properly sometimes, but I don't remember the details). So it's not clear to me if the right way forward is fixing "complete -F _git" to work again, or if that way is just broken, and a public version of __git_complete is the right path. Felipe, can you comment? -Peff