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

Re: [PATCH v3] git-completion.bash: add support for path completion

From
Manlio Perillo <manlio.perillo@gmail.com>
Date
Dec 19, 2012, 23:43 UTC
Message-ID
<50D2511D.3020705@gmail.com>
In-Reply-To
<7vzk1995mx.fsf@alter.siamese.dyndns.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 19/12/2012 20:57, Junio C Hamano ha scritto:
> [...]
I just found a serious bug with "git commit" path completion.

When doing the first commit on an empty repository, completion will cause an error:

$git commit -m init <TAB>fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'

The problem is that for a newly created repository there is no HEAD.

If HEAD does not exists, code must use ls-files instead of diff-index to get the completion list.

Another change is to always call git commands with stderr redirected to /dev/null.

By the way, this is also a bug of current bash completion code:
    $ git show does-not-exists:<TAB>fatal: Not a valid object name
      does-not-exists
I will write a patch (based on master) to fix this.
> [...]
Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDSUR0ACgkQscQJ24LbaUSkRwCfVKk9JhSD4sKDFm4heAkVbN0o KAAAn3paTXyUiFlfY/UBpnkwiARegLsE =7Q5s -----END PGP SIGNATURE-----

Previous: Manlio Perillo
Message 4 of 4 in “git-completion.bash: add support for path completion”
  1. git-completion.bash: add support for path completionManlio Perillo, Dec 19, 2012
  2. Junio C HamanoDec 19, 2012
  3. Manlio PerilloDec 19, 2012
  4. Manlio PerilloDec 19, 2012

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.