From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15425 invoked by alias); 13 May 2015 14:26:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35104 Received: (qmail 2723 invoked from network); 13 May 2015 14:26:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=postfix2; t= 1431527205; bh=GSpH8T/nDKbls+9AskStnlBd36IlH4M2HXOtlaVy5M4=; b=S JqYneEgZGyxjJlpaeg+4KikJdxtv1b/kN+RJmWtkrSQHcHRxrdFYylXir+puohDx Tjy2C6sayPT5ITOayr9pD3nBvgsyB0PE2dLm+XNHRDy2CWejH0AjaZdc/xRi8qNS iqND4xHuT1IeIuJMomp3b93fci6dw7HWjtTuz1m0Kk= From: Daniel Hahler To: zsh-workers@zsh.org Subject: [PATCH 4/7] completion: git: __git_commit_objects: query 1000 commits Date: Wed, 13 May 2015 16:26:28 +0200 Message-Id: <1431527191-32165-5-git-send-email-genml+zsh-workers@thequod.de> X-Mailer: git-send-email 2.4.0.dirty In-Reply-To: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de> References: <1431527191-32165-1-git-send-email-genml+zsh-workers@thequod.de> From: Daniel Hahler Also, `--all` and `--reflog` is used to get all commits. It adds the _guard in front, so only non-empty values will come here. Also, __git_commit_objects_prefer_recent will only call it, if there are no matching recent commits. --- Completion/Unix/Command/_git | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b590df0..faf2e55 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5655,12 +5655,15 @@ __git_commit_objects () { local gitdir expl start declare -a commits + # Abort if the argument does not match a commit hash (including empty). + _guard '[[:xdigit:]](#c,40)' || return 1 + # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}} + : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\\\[%h\\\]\ %s')"}} __git_command_successful $pipestatus || return 1 - _describe -V -t commits 'commit object name' commits || _guard '[[:xdigit:]](#c,40)' 'commit object name' + _describe -V -t commits 'commit object name' commits } (( $+functions[__git_recent_commits] )) || -- 2.4.0.dirty