Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Make git-commit complete both modified files and git-added files.
- X-seq: zsh-workers 23903
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Make git-commit complete both modified files and git-added files.
- Date: Thu, 4 Oct 2007 03:05:40 +0200
- Cc: "Nikolai Weibull" <now@xxxxxxxx>, "Clint Adams" <clint@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; bh=53UfPFMLiRaG7Gzg6oHnT0r4de7IdArCkiW+7VabWtE=; b=MRWJMIbtZMa6AgYiv5rIlgQn5B0GhmtR+UOPDtiNI0J+kp4N3Yhlbm3BU4Zbm9VYpCZMa+SHD2oLdCqVRDSGGPofBS/Ank1h6Q7P+SDjkeQ26Ak2tJdURVFt4kBmz9t4XRugQ89RdRPtOxy+AT2AASpcfvb5Qf9QRnIln78ccE0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=KtncYDH/2IGZP692jeI0/SOZwieGbP7dfbOvFZOFQehcbL8/ZcBz5oCfpAebtSAPwPwNHxvbhvS8oLPOk4C25TSs7zypLxMm+bF3isvsjBB218I7Tkpi+zXqCyrEpdqeOMseJNO32rCFeSiwlJWxIC6TmQPc/twhn+CsyIghb68=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This is useful when you've git-added two or more files, but you only
want to commit one of them.
http://git.mikachu.ath.cx/?p=zsh-cvs.git;a=commitdiff_plain;h=commit
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 3771da1..dfb9655 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1568,7 +1568,7 @@ _git-commit () {
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary
message]' \
'(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of
all file changes]' \
'(-u --untracked-files)'{-u,--untracked-files}'[show files in
untracked directories]' \
- '*:file:__git_modified_files' \
+ '*:file:__git_changed_files' \
- '(message)' \
'--amend[amend the tip of the current branch]' \
{-c,--reedit-message=}'[use existing commit object and edit log
message]:commit:__git_commits' \
@@ -2624,6 +2624,18 @@ __git_unmerged_files () {
__git_files $* --unmerged
}
+#this is for git-commit which can take files both git-added and not
+(( $+functions[__git_changed_files] )) ||
+__git_changed_files () {
+ gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
+ __git_command_successful || return
+
+ files=(${(ps:\0:)"$(_call_program files git diff-index -z
--name-only HEAD 2>/dev/null)"})
+ __git_command_successful || return
+
+ _wanted files expl 'index file' _multi_parts $@ - / files
+}
+
(( $+functions[__git_tree_files] )) ||
__git_tree_files () {
local multi_parts_opts
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author