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

Re: [PATCH] bash-completion: Make use of git status

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 19, 2011, 10:10 UTC
Message-ID
<201108191210.59538.trast@student.ethz.ch>
In-Reply-To
<1313474948-13531-1-git-send-email-panduwana@gmail.com>
Ron Panduwana wrote:
> $ git add [TAB]path/to/deeply/located/[TAB][TAB]
> path/to/deeply/located/modified-file   path/to/deeply/located/new-file
[...]
Show 6 quoted lines
> +# __git_files_having_status requires 1 argument
> +__git_files_having_status ()
> +{
> +	echo "$(git status -uall --porcelain . 2>/dev/null | egrep "^$1" | cut -c4-)"
> +}
> +
Some thoughts:
* running git-status for . has some issues: it doesn't work in the
  case of
    cd subdir
    git add ../some/file[TAB]
  It's also inefficient if you are at the top level and
    git add path/to/file/a/few/levels/down[TAB]
  since it wouldn't actually have to look for untracked files in the
  entire repo.
* -uall is not required unless you are looking for untracked files.
   For the other commands you could speed up completion by passing
   -uno instead.
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Ron PanduwanaNext: Ron Panduwana
Message 3 of 4 in “bash-completion: Make use of git status”
  1. bash-completion: Make use of git statusRon Panduwana, Aug 16, 2011
  2. Ron PanduwanaAug 19, 2011
  3. Thomas RastAug 19, 2011
  4. Ron PanduwanaAug 20, 2011

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.