Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _git-grep: Complete files when outside git repos
- X-seq: zsh-workers 47397
- From: Guido Cella <guidocella91@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _git-grep: Complete files when outside git repos
- Date: Thu, 24 Sep 2020 22:34:41 +0200
- Archived-at: <https://zsh.org/workers/47397>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-09/20200924203441.80963-1-guidocella91%40gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-ej1-f53.google.com) smtp.remote-ip=209.85.218.53; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=z7WJeOIik5hrtfy/wqc8Y5VxzugU2CubQ9a6fqjEA34=; b=Kq0IazBqhPGgb0Xoe5y5TSTL83u8y+HwLHxRJADs6TEmYkis/M2V5hm23olM6lEB/6 45EuCpEuVtQpg+kAaAHXCp20sHklOCyTpJW7O/CWfeY8XHhWuDBRxhImQTwFHYr8NVyC cX2fJxo9IUts7hFwoA2bfcVz6s5A4IfgLajD9ysdetwmxDGD69YInGqswNTzPJX+vN7s 5QhNAnKclTnnSYmspvxDTTcL3Slg5s3yh4NAhz1UhkM8wrcEmIZ+Mj1ZOEdeHTvI1Jxb y5FAr8QzlkOVT5+/XdqKOvZKOJx++8BysEY44Nk3qU+fRCtXOPMiSctU3vtP0v1YojVB 5MDw==
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- Sender: zsh-workers-request@xxxxxxx
---
Completion/Unix/Command/_git | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 05e2a23..67f06c5 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1037,6 +1037,12 @@ _git-grep () {
# don't complete treeishs.
case $state in
(tree-or-file)
+ # Check if we're not in a git repository.
+ if ! git rev-parse 2>/dev/null; then
+ _files && ret=0
+ return ret
+ fi
+
integer first_tree last_tree start end i
(( start = words[(I)(-f|-e)] > 0 ? 1 : 2 ))
--
2.28.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author