git/list[1] front-page[2] threads[3] people[4] search[5] about
 

bash completion in backticks partially broken

From
Shawn Pearce <spearce@spearce.org>
Date
Nov 5, 2006, 09:05 UTC
Message-ID
<20061105090540.GA4843@spearce.org>

So an annoying feature of bash appears to be that it won't really provide completion on backtick'd commands.

For example I can complete "git merge-base ma" just fine as is, but if I toss it into backticks say "git update-ref M `git merge-base ma" then I can't complete "ma" out to "master" anymore.

A little bit of debugging appears to show that bash is invoking the completion hook for the outermost command; that is we are looking for parameters for update-ref and not merge-base.

I think I could rewrite a good part of git-completion.bash to support this use. But it won't work for "echo `git merge-base ma" as the outermost command is echo and we don't have a Git completion hook registered for that command.

This is really annoying when it comes to less contrived examples. I find myself forming odd pipelines with commit-tree, update-ref, mktree, lstree, sed, rev-list, etc. and always keep bumping up on the limitations of git-completion.bash.

Any suggestions? How often do bash users try to use backticks to call Git commands, only to find bash isn't being as helpful as it should be?

Next: Junio C Hamano
Message 1 of 3 in “bash completion in backticks partially broken”
  1. Shawn PearceNov 5, 2006
  2. Junio C HamanoNov 5, 2006
  3. Shawn PearceNov 5, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.