Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Add --cached to git-diff completion
- X-seq: zsh-workers 23907
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Add --cached to git-diff completion
- Date: Sat, 6 Oct 2007 01:13:48 +0200
- 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:mime-version:content-type:content-transfer-encoding:content-disposition; bh=D4V+WI5HYBczJTf+LD93g9cIlbDLJRW1b6a/rNHhan8=; b=rvT3SYaHd7p1q26p4+9oKx2McAkDyy8T15/t1Pgb03+jK5xleQ+iAai6YB45lNGJecezEkBJkGML5kh1Y+fg8LWh8L4PVgGgcLSHqVP/YaBJej++XtG3ZDFtQv8H+UkDpYm2CSAp+/Q1G4aAQkdfnMojXjP2GsPkdw3ASsn0ZuE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Q/iO3KF2XgJLojQ28ylAzhVIdObGhbhkPH+nXxJjhbDL/e1zVTAHYUo83z+wMTcUg7dw17IuIWlFm4OikzLg9h0c9aY0WCAqEv+jrqUSgdijefOpkcnEnyv6pNZh3Ersj3cMB2VEo6C8pZazd5uD/jI0RHwkxLTZk/MjNkuy4H0=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Not sure how to make _arguments do different things based on options given,for
git-diff ... -- <tab>
it should complete files
and for
git-diff --cached <tab>
it should only complete one commit, not two, since we're diffing
against the index
but i think the following change is still better than not. (don't add
--cached to $diff_args
since that is also used for git-diff-index and others where the
description is different).
diff --git a/Completion/Unix/Command/_git
b/Completion/Unix/Command/_git
index 3a365e5..9dcb481 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1585,6 +1585,7 @@ __git_zstyle_default
':completion::complete:git-commit:argument-rest:*' ignore-l
_git-diff () {
_arguments -S \
$diff_args \
+ '--cached[show diff between index and named commit]' \
'::original revision:__git_commits' \
'::new revision:__git_commits' \
'*::index file:__git_modified_files' && ret=0
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author