git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: git@vger.kernel.org
Cc: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Subject: [PATCH/RFC] completion: support git blame
Date: Sun,  9 Jan 2011 11:38:39 -0500	[thread overview]
Message-ID: <1294591119-19701-1-git-send-email-martin.von.zweigbergk@gmail.com> (raw)

Add basic support for completion of refs with git blame.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---

Maybe leave --porcelain and --incremental out since they are intended
for scripts?

blame is pretty uninteresting on untracked files. It would be nice if
to only complete files that exist in the specified commit, just like
'git show $rev:$file' does. I think this applies to some other
commands as well, like 'git checkout $rev [--] $file'. Has this been
discussed before? I didn't find anything when searching the
archives. I can imagine it might have been rejected because of
performance problems.


 contrib/completion/git-completion.bash |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 645549c..d9074ba 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1128,6 +1128,26 @@ _git_bisect ()
 	esac
 }
 
+_git_blame ()
+{
+	__git_has_doubledash && return
+
+	local cur
+	_get_comp_words_by_ref -n =: cur
+	case "$cur" in
+	--*)
+		__gitcomp "
+			--root --show-stats --reverse --encoding=
+			--contents --date --score-debug --show-name
+			--show-number --show-email
+			"
+		;;
+	*)
+		__gitcomp "$(__git_refs)"
+		;;
+	esac
+}
+
 _git_branch ()
 {
 	local i c=1 only_local_ref="n" has_r="n" cur words cword
-- 
1.7.3.2.864.gbbb96

                 reply	other threads:[~2011-01-09 16:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1294591119-19701-1-git-send-email-martin.von.zweigbergk@gmail.com \
    --to=martin.von.zweigbergk@gmail.com \
    --cc=git@vger.kernel.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).