git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Ron Panduwana <panduwana@gmail.com>
Cc: <git@vger.kernel.org>, "Shawn O. Pearce" <spearce@spearce.org>,
	Junio C Hamano <junkio@cox.net>,
	Lee Marlow <lee.marlow@gmail.com>
Subject: Re: [PATCH] bash-completion: Make use of git status
Date: Fri, 19 Aug 2011 12:10:59 +0200	[thread overview]
Message-ID: <201108191210.59538.trast@student.ethz.ch> (raw)
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
[...]
> +# __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

  parent reply	other threads:[~2011-08-19 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16  6:09 [PATCH] bash-completion: Make use of git status Ron Panduwana
2011-08-19  9:54 ` Ron Panduwana
2011-08-19 10:10 ` Thomas Rast [this message]
2011-08-20 12:46   ` Ron Panduwana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201108191210.59538.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=lee.marlow@gmail.com \
    --cc=panduwana@gmail.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).