From patchwork Mon Dec 10 15:10:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koji Nakamaru via GitGitGadget X-Patchwork-Id: 10721413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3B5A1751 for ; Mon, 10 Dec 2018 15:10:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E39282ABDB for ; Mon, 10 Dec 2018 15:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76E62ABEF; Mon, 10 Dec 2018 15:10:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AF632ABEF for ; Mon, 10 Dec 2018 15:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbeLJPKu (ORCPT ); Mon, 10 Dec 2018 10:10:50 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45629 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728011AbeLJPKs (ORCPT ); Mon, 10 Dec 2018 10:10:48 -0500 Received: by mail-pl1-f196.google.com with SMTP id a14so5373872plm.12 for ; Mon, 10 Dec 2018 07:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=LTg051jqGhZ6R0241RZgayYlU55OPaR77YN/grYYbxQ=; b=qAv+Bgqw/j8X1PfjmLpXOp8VQifDlsmlE2gNxrsY31AwVFmzCDsl8/aMk1r5y8F5tt DS+EWcz3J2vv03pdbwzkgVXtaLGFTMKdmen7UyAcpmPHOcmvDOnoYAwrxQcw6FFhfaND nLjsDEy3sFthlxWSBGUdG66XfH6ki5TIoP970kSCZLfyjp3bkf0MuFhnliHJY2tLKcBp 0GlvHFIAj+ujiq2TPW9g+ZbFV6Ln5SB89TS1V5I6sACURGCaVp2LTrC+7UEghch9GRPP ImdXNE094lp0eAPMQtZOwLhXp3OM8uHWWn6rJYh/W9SlHaWeaABRt+WMDi8aPc2/B8Zi asyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=LTg051jqGhZ6R0241RZgayYlU55OPaR77YN/grYYbxQ=; b=hwXOBXkxN0gRXjFJwrG+XLJ3QatGA5W+QKnlYf02m2DGwFMCqv+pjiSvkA/ZD9jXzN qT6jw0abGUGnT75yC3iv6isEhzolxjLIoMh9mz2o+GoYy95ySGcLSmM4eKBcxcf3QfqM jOzPCVS2fAaPUDVR+1E00ermhi6w7tshyjA+F8DLV/p5rNGKeNyhtZSqMIt83yOJAVUU aiBOGDualbu/3UMjTWJ23Hey6VTlEs44iVUEbC6JFN6OK6ycCP6uThrRkjQwSvYRzLEp tujBmCFKO4iVSSZ43plsKd+AD6iBlOkvLvEY+3y7nLU7urjbYcPw3kclkPGDlxUZOczP 7p1A== X-Gm-Message-State: AA+aEWaOMJmGGcktyBQWUucMwdBn6ONG5FbC41FOw1pBsyjbmyf1gdq3 NcmD9IsT5nZEHg/RBIt52nqKY1bw X-Google-Smtp-Source: AFSGD/VRhbh42EWiQfKZCpkqAtj7zeLhhKtx48CdmM2Y9A2rhvB8xN+a5S40x2pgqVJlgFr2gEusKg== X-Received: by 2002:a17:902:a83:: with SMTP id 3mr11656900plp.276.1544454647160; Mon, 10 Dec 2018 07:10:47 -0800 (PST) Received: from [127.0.0.1] ([40.112.139.188]) by smtp.gmail.com with ESMTPSA id 4sm26871260pfq.10.2018.12.10.07.10.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 07:10:46 -0800 (PST) Date: Mon, 10 Dec 2018 07:10:46 -0800 (PST) X-Google-Original-Date: Mon, 10 Dec 2018 15:10:43 GMT Message-Id: <830191fbfbf95b9d568ba91ddcdd9860173a476a.1544454643.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 1/1] completion: complete in `git worktree add ` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The second non-option argument to `git worktree`'s `add` command is an optional revision. Let's complete it. Inspired by https://github.com/git-for-windows/git/pull/1681. Signed-off-by: Johannes Schindelin --- contrib/completion/git-completion.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 9e8ec95c3c..4194b4a2e7 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2773,6 +2773,11 @@ _git_worktree () add,--*) __gitcomp_builtin worktree_add ;; + add,*) + if [ $(__git_count_arguments "worktree") -eq 2 ]; then + __git_complete_refs + fi + ;; list,--*) __gitcomp_builtin worktree_list ;;