From patchwork Mon Aug 16 09:10:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12438029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2896C4320A for ; Mon, 16 Aug 2021 09:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A6496113A for ; Mon, 16 Aug 2021 09:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235171AbhHPJLB (ORCPT ); Mon, 16 Aug 2021 05:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235091AbhHPJLA (ORCPT ); Mon, 16 Aug 2021 05:11:00 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F90C061764 for ; Mon, 16 Aug 2021 02:10:29 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id o20so25757949oiw.12 for ; Mon, 16 Aug 2021 02:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S0X0QqbgBQoqTrKw0OU/KboIDFkecYk7oQsICFv+w0s=; b=sZBtrQowXNySn9pz8LgvC/wPCv8x64KkI9NSXimnKB3jNk9JX2mC64ZSAWnf+yAV7c Jj/VqGhvmJrPquzcYNBRGxewhGuhQCKn6+3dSck522iwQnmuzLqRu992vfl2ZyoLejVj Djjh4DkdQShJsGhv9WvoDzIwhYsHyStylgV9itA/YLvN4ycI0fo1tsnaQP40Gn4lA4u+ PGG1NOf0SV1iVhktfaSgTLk+wKhX+MTUKVYw1JNZJZRnc+7iLD9j2FTOsQrH9lG8Bm7n jkKmUIfdVr+NscPNWgsx+MuDYbaLHQ3686ETMbi+DmyFLp8EBN3NCTXb3LoirszWzo/X rU2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S0X0QqbgBQoqTrKw0OU/KboIDFkecYk7oQsICFv+w0s=; b=fg1Ov8MWZVuU0pOdwNKVy/7F7qDPDQizaXl3Fw6sLG4HfPMtj5lSJ+fnAnXQNsWJT0 EB1bx4fyFLoUjqB3y1wsSpdQFhUkN2Urz6oVYWDotMu5Jv4vmd8ULUJzKaAw+U+65QK0 R0B7WWO8psbUG5zWYiDUE4ubRKjt0Z1JBVopFzg3isTRpEaejrFvCXx7IQIibmNcDiJt UjYXIbqsJaDwud+JqX+/ky2SQ8MhPGsL1Ving+XA7h5ybpkeHD/8GHGdDNxdetDL6nzB PcCIRult2ZWT2jRQeU3XB18OP2aWUXJrs6XVH06WdxYhofuyGylx8MV9uyD8xBCT+U8z Viqw== X-Gm-Message-State: AOAM53228WeoUJ4OFWYo1y+1FTV748yucMdgPtO/eL3w9pim0+LMjhxq 5acqS45qXspvWRFMRCg4D/UdUY5iboM= X-Google-Smtp-Source: ABdhPJx/KFQD59HKgs4YTd93IFMxTi2n1UFHYcWkV3E2YZpUvHXBi0PUA51Tt7uNAqFqktAdbGG0/w== X-Received: by 2002:a54:4182:: with SMTP id 2mr811832oiy.66.1629105028719; Mon, 16 Aug 2021 02:10:28 -0700 (PDT) Received: from localhost (fixed-187-189-69-1.totalplay.net. [187.189.69.1]) by smtp.gmail.com with ESMTPSA id m206sm1973603oif.23.2021.08.16.02.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 02:10:28 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Felipe Contreras Subject: [PATCH v3 try4 1/4] completion: bash: fix prefix detection in branch.* Date: Mon, 16 Aug 2021 04:10:22 -0500 Message-Id: <20210816091025.548095-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.48.g096519100f In-Reply-To: <20210816091025.548095-1-felipe.contreras@gmail.com> References: <20210816091025.548095-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Otherwise we are completely ignoring the --cur argument. The issue can be tested with: git clone --config=branch. Reviewed-by: SZEDER Gábor Tested-by: David Aguilar Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 4bdd27ddc8..6bcf97ce79 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2650,8 +2650,8 @@ __git_complete_config_variable_name () return ;; branch.*) - local pfx="${cur%.*}." - cur_="${cur#*.}" + local pfx="${cur_%.*}." + cur_="${cur_#*.}" __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx" return From patchwork Mon Aug 16 09:10:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12438033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3CD0C4320A for ; Mon, 16 Aug 2021 09:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 834B761B5D for ; Mon, 16 Aug 2021 09:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235265AbhHPJLE (ORCPT ); Mon, 16 Aug 2021 05:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235185AbhHPJLD (ORCPT ); Mon, 16 Aug 2021 05:11:03 -0400 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8AAC0613C1 for ; Mon, 16 Aug 2021 02:10:32 -0700 (PDT) Received: by mail-oo1-xc2e.google.com with SMTP id b25-20020a4ac2990000b0290263aab95660so4742284ooq.13 for ; Mon, 16 Aug 2021 02:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pBJDJRFPG8PsuqUZ7/xyal6w9nauHokJcq7BwxuhENs=; b=uppQlyyr1xpBqnxede2pIRqueECaJTXJOoCa+t8+V1Q9LVGYNmenZlwuBuvAo1Awy2 8iiEzWRemqGw72DooPyXN4iV9Dl5hPqdu1mcsWmQLay+1oKRCAmL+XkCl5GrutijswHw gADK4/f2JKVVqN9D0B7FflVZCMewYFmcoqpgESlFFiG5De1CwfeGZdTMBQy8TJOBFjgF bNCYNjTfh8JPi0MXT+QHthGbDcnbYTOTWBmGEV1IgSAeRRAiemhN3aJVBnHLeCaizJba GBiKj5KND55U00LPj46MWu81vJn9EtfWo25yLzMwjNQziaNnKX0qAKy2SJU++Jr72+nJ 7onQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBJDJRFPG8PsuqUZ7/xyal6w9nauHokJcq7BwxuhENs=; b=t3B5CrN5Fp+X/6yXvQCuYPp3sgCwIP8q6SLJCW4bMEwxATeFYcmxVmtU0nDX7VeVjt xMyq0RRKjlQGERUItBH+KsqztU0sszVdVMBdDbg7oDlvhtfjV/GWU7vPZQPjWkFHwQaY jjsNpqKoV12oXmweSFOQ3LgMBXPUWSVwDPCQImIiC4Pq5zJNLQptUhF/98nCe8cIMUtg FX3a7DaVZdWO3PdZ+W0l3fG1dQJHZ08VIamcDsFOaYofCQPwK/oFvOSkAPDxj4UebhXc v2mPC7CRxEm3PDJMYd6isoyyIXBiOlOAUXfs6RGILvdckB8XSTn6iD/xE0yglLf5Cvwj a6ww== X-Gm-Message-State: AOAM532gBZmLUAPky2A/CZ3uBq1CFWJKlrNjS+/exXQ3/W0DspukLTvX hznSVgXnp/BoPgkpuz27EoaZQ12Uod8= X-Google-Smtp-Source: ABdhPJxUtRLi1c1NNX1vnpB0/LKjDsQWSSCm4MHgq/+Tmm8CGR79FQeWQ2K1XvjzQRfr3/2R77xJPQ== X-Received: by 2002:a4a:2c49:: with SMTP id o70mr8995521ooo.71.1629105030232; Mon, 16 Aug 2021 02:10:30 -0700 (PDT) Received: from localhost (fixed-187-189-69-1.totalplay.net. [187.189.69.1]) by smtp.gmail.com with ESMTPSA id z7sm665518oti.65.2021.08.16.02.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 02:10:29 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Felipe Contreras Subject: [PATCH v3 try4 2/4] completion: bash: fix for suboptions with value Date: Mon, 16 Aug 2021 04:10:23 -0500 Message-Id: <20210816091025.548095-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.48.g096519100f In-Reply-To: <20210816091025.548095-1-felipe.contreras@gmail.com> References: <20210816091025.548095-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We need to ignore options that don't start with -- as well. Depending on the value of COMP_WORDBREAKS the last word could be duplicated otherwise. Can be tested with: git merge -X diff-algorithm= Tested-by: David Aguilar Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 2 +- t/t9902-completion.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6bcf97ce79..7aea1abda5 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -356,7 +356,7 @@ __gitcomp () local cur_="${3-$cur}" case "$cur_" in - --*=) + *=) ;; --no-*) local c i=0 IFS=$' \t\n' diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index cb057ef161..6b56e54fc3 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -540,6 +540,15 @@ test_expect_success '__gitcomp - expand/narrow all negative options' ' EOF ' +test_expect_success '__gitcomp - equal skip' ' + test_gitcomp "--option=" "--option=" <<-\EOF && + + EOF + test_gitcomp "option=" "option=" <<-\EOF + + EOF +' + test_expect_success '__gitcomp - doesnt fail because of invalid variable name' ' __gitcomp "$invalid_variable_name" ' @@ -2380,6 +2389,12 @@ test_expect_success 'git clone --config= - value' ' EOF ' +test_expect_success 'options with value' ' + test_completion "git merge -X diff-algorithm=" <<-\EOF + + EOF +' + test_expect_success 'sourcing the completion script clears cached commands' ' __git_compute_all_commands && verbose test -n "$__git_all_commands" && From patchwork Mon Aug 16 09:10:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12438031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DFC1C4338F for ; Mon, 16 Aug 2021 09:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 018736113A for ; Mon, 16 Aug 2021 09:10:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235236AbhHPJLE (ORCPT ); Mon, 16 Aug 2021 05:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235091AbhHPJLD (ORCPT ); Mon, 16 Aug 2021 05:11:03 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C9AC061764 for ; Mon, 16 Aug 2021 02:10:32 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id o185so25698103oih.13 for ; Mon, 16 Aug 2021 02:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lmMOjKD2GdJ3kfvxotA5vQuZ/R3UdAVe9/YJgY3VHPw=; b=MFeSYuA0JsA7aDd7KCGMv+FRi5rFTOXzxEqybpnzYfhVBYX9gC0ntCTrbs5y4IQM6r FMRy4E7LbV/lKh7oggRzT7j2gpCmg/tyK919HpLE0Rvxh0IreuO6gIOH8Tpsk4wWVdsR 2xJ7XAoGri+UGR0rH/OInR5kZqkvM6CmPOAlEOiAYJ0r2nSP4rKN2jMMx0qdXJLqDnPf 0MTWXru1Z33cQZaoL8WuPxiSMR9pn9zLXiPhZPUrYp8bo4EW+NI59mTaGseGSbpjnZJa ofHavBfYymy39qh9QdguzU0FbqX0HDojA/lFPkRFwACnMTzcbvyuK88sSFbhlswIVTIS OWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lmMOjKD2GdJ3kfvxotA5vQuZ/R3UdAVe9/YJgY3VHPw=; b=cSSQ1zF4wb4WFqM365pI19YLgwCVHuVIyAHefdbWNrROJ/4CuNAndNp3jzMIEGX+kU cNhF2wGAZ9zS+QJWQtTXtxGN5XtYTWj/wad1l1J5OjEruUOHVTG69/plWAbtDjyXWUhb maW4wGET3+AgyWNTTsKpC2E0SJh0HCDL6N8KZcZ50ydaJzZW1N79MNCtd02cCZMyGxtL YNR4npL+VHx7QRlb7KdmUF/jva9fgstHaxFSsRWZmCQAUz9UXf8EVHhtZsspNRtVSC36 DYsqLojj5iF50Ey/J60QrZCA5+AamPbuNBIswXiNePX4Cw+XDj2jBNtwyAHAW2DG2kip O29w== X-Gm-Message-State: AOAM5334SPbuDdvBabcXHKs9DW/ZxVgu3oVpz4MLeA2u2/O5bO3K0gM6 NsMw3yQ9fjmTmjGnXGMAlAIpdmYDtyk= X-Google-Smtp-Source: ABdhPJyK0/VFAJJciqrcNVa5+Iz/RoQiZnpF+0z62tObX7h3bzCzZE5TrbgjtdRwn17UQzFKIiIuUQ== X-Received: by 2002:a05:6808:2208:: with SMTP id bd8mr11244721oib.110.1629105031825; Mon, 16 Aug 2021 02:10:31 -0700 (PDT) Received: from localhost (fixed-187-189-69-1.totalplay.net. [187.189.69.1]) by smtp.gmail.com with ESMTPSA id q62sm1985977oih.57.2021.08.16.02.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 02:10:31 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Felipe Contreras Subject: [PATCH v3 try4 3/4] completion: bash: fix for multiple dash commands Date: Mon, 16 Aug 2021 04:10:24 -0500 Message-Id: <20210816091025.548095-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.48.g096519100f In-Reply-To: <20210816091025.548095-1-felipe.contreras@gmail.com> References: <20210816091025.548095-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Otherwise options of commands like 'for-each-ref' are not completed. Tested-by: David Aguilar Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7aea1abda5..b7988f0485 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -421,7 +421,7 @@ __gitcomp_builtin () local incl="${2-}" local excl="${3-}" - local var=__gitcomp_builtin_"${cmd/-/_}" + local var=__gitcomp_builtin_"${cmd//-/_}" local options eval "options=\${$var-}" From patchwork Mon Aug 16 09:10:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12438035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9412C4338F for ; Mon, 16 Aug 2021 09:10:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5E5961B5D for ; Mon, 16 Aug 2021 09:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235228AbhHPJLR (ORCPT ); Mon, 16 Aug 2021 05:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235185AbhHPJLF (ORCPT ); Mon, 16 Aug 2021 05:11:05 -0400 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24107C0613C1 for ; Mon, 16 Aug 2021 02:10:34 -0700 (PDT) Received: by mail-ot1-x334.google.com with SMTP id u13-20020a9d4d8d0000b02905177c9e0a4aso9549498otk.3 for ; Mon, 16 Aug 2021 02:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nJdQToOZUIYvgkQyrKL3Sl89UqLtkGhjc2qvxbmVIOw=; b=Z3gBOeMY6uwYwHo2IHmSF/dYDSBL40aNwcgIXB63Qj5P2cZ0vtT5MH1u1X6/4d7Wrm yGb/WeDSGjPoHMm/9IeCAIwaI1btUDqH8GWXGCpVyyk7y6TiFtzzp3b+gL9nPggHQ/Yf 4WA2Uz7MJ5YutjEaOP/ihqhT8ITjsxUamtsgxBqXiueeDkHsybQrKU8UVtgV+YYZLfIT jmeU+dr3ELMLs7VzHutMizzpzoopScmmfTzRc1dINJ/Vg4UGbBCuXyJWFtJgReM1u0UN 3hCtMjpM3sGeJ+PCs/qT/Mb70+mQmWH2r5PVbk/tvwh6aUczNglVvuxsXn05Uf8zJFVQ L5Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nJdQToOZUIYvgkQyrKL3Sl89UqLtkGhjc2qvxbmVIOw=; b=J+7HqJuIqNOSSGq0m7KiNQF8RmcX29wCHOHO8ey8hKqX3/S17QuNQAag+KRlnNYIke m1KNJbqgsS+EEwD7FG0yN1+9ECzAli0MesFcwZhc9AmcJsac3h2GYn/ar2HJrh/FC0BN dUqA3agLMjlDPMByieSYU9pgjoiS/o3AznOoih1B+l/Tqj0AJSD63I8u9e34SjlFfiDa 5MLuKW0zYdovZ4vcPHERr1mAGMcmmmkUpPiczOl9Lq2kzGWyh902WguzxOYOlrpD7uaA Y7o/qAPc718KvN9oUok8YtI9GRHULfl1D7nvcn8Xcw3TWK+EI9i1MVxmC0+EoGWENrLT fwDA== X-Gm-Message-State: AOAM531Hqwl0VjO7RR0MfTCyTisPfsAr/yuuk6XxDGklElOSvJ8t8Bj/ hcg1kWTaIEaL33FRpH9mj6WyJeh4I8M= X-Google-Smtp-Source: ABdhPJyBU4y4d6fnEZjQdpxCFAQnZyUbuXOLu9LR0cmpUzdkEs9wmtRihOrHPLaLiR9BLdkjX8yxbw== X-Received: by 2002:a05:6830:1f55:: with SMTP id u21mr11801207oth.4.1629105033349; Mon, 16 Aug 2021 02:10:33 -0700 (PDT) Received: from localhost (fixed-187-189-69-1.totalplay.net. [187.189.69.1]) by smtp.gmail.com with ESMTPSA id s24sm826714otp.37.2021.08.16.02.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 02:10:33 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Felipe Contreras Subject: [PATCH v3 try4 4/4] completion: bash: add correct suffix in variables Date: Mon, 16 Aug 2021 04:10:25 -0500 Message-Id: <20210816091025.548095-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.48.g096519100f In-Reply-To: <20210816091025.548095-1-felipe.contreras@gmail.com> References: <20210816091025.548095-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org __gitcomp automatically adds a suffix, but __gitcomp_nl and others don't, we need to specify a space by default. Can be tested with: git config branch.autoSetupMe This fix only works for versions of bash greater than 4.0, before that "local sfx" creates an empty string, therefore the unset expansion doesn't work. The same happens in zsh. Therefore we don't add the test for that for now. The correct fix for all shells requires semantic changes in __gitcomp, but that can be done later. Cc: SZEDER Gábor Tested-by: David Aguilar Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index b7988f0485..8108eda1e8 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2653,7 +2653,7 @@ __git_complete_config_variable_name () local pfx="${cur_%.*}." cur_="${cur_#*.}" __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" - __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx" + __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "${sfx- }" return ;; guitool.*.*) @@ -2687,7 +2687,7 @@ __git_complete_config_variable_name () local pfx="${cur_%.*}." cur_="${cur_#*.}" __git_compute_all_commands - __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx" + __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx- }" return ;; remote.*.*) @@ -2703,7 +2703,7 @@ __git_complete_config_variable_name () local pfx="${cur_%.*}." cur_="${cur_#*.}" __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." - __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx" + __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "${sfx- }" return ;; url.*.*)