From patchwork Sun Jun 6 18:47:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12302147 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 694E2C4743D for ; Sun, 6 Jun 2021 18:48:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C9D9613EF for ; Sun, 6 Jun 2021 18:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbhFFSul (ORCPT ); Sun, 6 Jun 2021 14:50:41 -0400 Received: from mail-oi1-f175.google.com ([209.85.167.175]:46743 "EHLO mail-oi1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbhFFSul (ORCPT ); Sun, 6 Jun 2021 14:50:41 -0400 Received: by mail-oi1-f175.google.com with SMTP id c13so10234645oib.13 for ; Sun, 06 Jun 2021 11:48:40 -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=qA2rOvV73eh/ZtL1yKv0TyujlQKvNbtW1ksyilAmOtU=; b=ihMDSbnp/smIGm2qYymqRblpuDiNUYmViZ4N+d+12BAWSAfD2V3s1q4rKCq+3LtXIz C6ORuGbWj90rt4/1zv1Xk6dh/2//bcS0HfUjBljV+09FH+aeREqmPPk03dOCTyp7PU11 2UubunLiAsE5T+GOCXicS2ELEh/wQaNMInHaEz6tsjLfkRbnbSLFInREIQxV5xvHZyV5 U6K9j+T5QutG1D/7XDKwV4bOKKFMnVqFwed7tsR2FIr4SlbRJnJxC77VoBQwvFKY4pz3 T/2nmdQ/zHP+vNukfK3ijQZ4E9WyT4SMUND8UCMMHJSysihcjNqKwUOnny2LaYwCLErz zkEA== 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=qA2rOvV73eh/ZtL1yKv0TyujlQKvNbtW1ksyilAmOtU=; b=kWzGIv4H4yHVOF6/W9cUCzefCpvWI8elsbAMrCUkpLT528lyZ0wpaamPlwaxTaeNNL +QU0ToBNCN+ZV7VUNX6U5TMS0Td+cksL1mFHSxcJtl+G2UgtWKwN8EUAlcYQmLwppveF E3dLOfUvcgxzTRIDWQ88+/MBxAhi8tpRZJ/4Up4l9b5L9FjNKU9rr9Yc/hvOIu23jXZ7 IlEpeeoyqsqrscBSuGT99EUd3ujUzVOOriNFdTsJA/tgEBmtYavP6Bhv/PxAR1m1+hsG kNIVE/xA56CWYmoXjODaTACD3Dy+bUzhbWV563lNugFXuqTDH+cdQSov86xQU08ZllNd zMug== X-Gm-Message-State: AOAM533D3R5ynHXiScTcqas1pRXuse6jFcOLW0Xwvr2EzUGWZ4BIPXuS ynh1moT+D+HV7on3AbNkPjKTZ7gOsVE6ZQ== X-Google-Smtp-Source: ABdhPJyop+YW21e5en9rAsBH6BNW7/jsd/t1xH4yx0ykHl+GHm38TlnPPfOricKmFa6Z/qnsyDcjLw== X-Received: by 2002:aca:edc5:: with SMTP id l188mr3936543oih.134.1623005260412; Sun, 06 Jun 2021 11:47:40 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id c19sm1803087oiw.7.2021.06.06.11.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 11:47:40 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v2 try2 1/4] completion: bash: fix prefix detection in branch.* Date: Sun, 6 Jun 2021 13:47:23 -0500 Message-Id: <20210606184726.1018460-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.1.2.g0532ba4bf6 In-Reply-To: <20210606184726.1018460-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-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 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 b50c5d0ea3..47b48fbab6 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2649,8 +2649,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 Sun Jun 6 18:47: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: 12302143 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 0EB2FC4743D for ; Sun, 6 Jun 2021 18:47:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D01A0613EF for ; Sun, 6 Jun 2021 18:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbhFFStd (ORCPT ); Sun, 6 Jun 2021 14:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhFFStd (ORCPT ); Sun, 6 Jun 2021 14:49:33 -0400 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1856DC061766 for ; Sun, 6 Jun 2021 11:47:43 -0700 (PDT) Received: by mail-oo1-xc33.google.com with SMTP id x22-20020a4a62160000b0290245cf6b7feeso3601748ooc.13 for ; Sun, 06 Jun 2021 11:47:43 -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=Mv+Cefy9wvrPE14KIoxHNQPN4t5LZB/xfpHKLXR6F+Q=; b=Fim3tDCLVF8+ERNWtHmxxfp1wMv2cNGon2aVaxP1Q5NJTtXxBJOhlNGqQR57Km6ZBK Tpn8Neq5ScTOLKK6k3eCyDvY4lalRLYRDICbcniNGRnRPW/KdejX/7AsAy4FxdUaG97a TTGAt9Mxu7rJ4J4+kX8jl27pyXLl7TR/bxPW9q9yW9Xgrfxaxf9nO0953sqH0DCjqhxf XDpM9xrRDG0w7eI/1C1sgWfg4jCJedLjoKeiDXWQheG89pIonBkdV3y2r1M8bIYHc+bS L0vE5Y9FLsnpbA5Xjuw/EzRJcRkRcjOkWdaEq65ytyIMOy+ZZ7wTnP6PvBpKGh7FeShq 69PA== 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=Mv+Cefy9wvrPE14KIoxHNQPN4t5LZB/xfpHKLXR6F+Q=; b=rrBqenvX2asFpHdI9FE3oQkDpGBW9Naj8sgqKKsoOuKMmSmm8H8vt/ODBh1zNtSYD5 NafiDQc5YIDHt8ga9IuP6iSjH8aHkgZMyf+Y+ArGezQ+R5hca8hWbe/6n2QDZKOEHnBQ sIBxJYtu+7DhXzAnI1NpDkk7A/F1rKCzk8qMSzYZ6OZjbnwSXisO7djs9HOVH9gt/rGI PmNQk2SUXoLFhB0is/4gBukAoOuj9Jd0nhWra1M2x6oriUMBCoIYaRSXyX18qgZn827/ A2d1dwiwO/FRCvHegTjEg/vHcHL3V/Cw+vpOr7SGQeJITsB0bWNjrqPutSXrXm/W1Q5Q IW1g== X-Gm-Message-State: AOAM530LnzxZW2a7hC37Vl+l9gYasOJYR/Pg5lBFF5UWbOXFNGsmM9J9 KJlyZLySQz2YwrvuSFZOVE87qmlLcxashQ== X-Google-Smtp-Source: ABdhPJxI+GmNC1kiFWeql2gaq4acix/BHCRPWztNOMs+iZFUlr8JXI4RCEXgP8tMqvtLBI2Co3D9Ng== X-Received: by 2002:a4a:85ca:: with SMTP id u10mr10896918ooh.80.1623005262285; Sun, 06 Jun 2021 11:47:42 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id j26sm1867709otp.15.2021.06.06.11.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 11:47:41 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v2 try2 2/4] completion: bash: fix for suboptions with value Date: Sun, 6 Jun 2021 13:47:24 -0500 Message-Id: <20210606184726.1018460-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.1.2.g0532ba4bf6 In-Reply-To: <20210606184726.1018460-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-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= 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 47b48fbab6..05606609f9 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 Sun Jun 6 18:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12302149 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 0297EC4743E for ; Sun, 6 Jun 2021 18:48:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D80D1613EF for ; Sun, 6 Jun 2021 18:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbhFFSun (ORCPT ); Sun, 6 Jun 2021 14:50:43 -0400 Received: from mail-oi1-f172.google.com ([209.85.167.172]:42886 "EHLO mail-oi1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbhFFSul (ORCPT ); Sun, 6 Jun 2021 14:50:41 -0400 Received: by mail-oi1-f172.google.com with SMTP id v142so15348032oie.9 for ; Sun, 06 Jun 2021 11:48:44 -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=2bZWC4LFFLD2JTwh6FRtgEsmYrPY1OFvOXxslG+PJqg=; b=JK/wpH0ElwcwnXmuZnvCMqTi1NR4BdE8e8x4SNjpP20x0FtdgkiBRsY3rPyRTsoDMr tc5VpNLupPA/Dxx0n+3JqJyfw34DNiwUCwsdMZRZgCtLFK/pxXz9OKz7mobpxLkus3gG Fd86SXLmdr2ru2TWTbZl1/kym4LELcchVqwtj3vuWcFvebV2ybwOLJZG+JIrJeettKWM BhfhjTKNS0F6A1zoLU7a23tr1wzfJYKEQkXW5MNIVsA1hcy/DYmtmemajXuR8pJHVFfF 7/7Spd0gK4XDJqEMhYQEzGj3EJw6R4vE7wB4mtNdAiT4PYCDU6dV22HUUJMdUROJnPWT srUQ== 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=2bZWC4LFFLD2JTwh6FRtgEsmYrPY1OFvOXxslG+PJqg=; b=suJcoosBFNRpHHh2aOzLDV6SfpM99BfJkfvuzxvrKzLpnH0VtRHbowDD1MGUKP6eXd O8xSyuXHLsAshWkomakWw8s8ASMwwZlpJooJ1Sdj8KNGIieancWAO65zZ9jZWSh+q7OX 3X10dakEDsl5XA/JcE1WTazfl7cMrMVwx650Tu4nhfj/UaopoYtX5mLokBFVK+RUyzYo V7/qaaV+FWjidSmYsWWGASxyVcdMRwC74dxvt6tKuSBp8JnRyB3say1GOkB46os1twYT dRY7rEuSNpBP66N7Nd6GtE2TEKJGNzMdyTaOKvM7LTD6TEctK2GUjK6oDBszuzGetP3j uing== X-Gm-Message-State: AOAM532ek+Tptj5DcPLkfxRNFoWi5+D4k23ZrEOESUljFLWjPZ0Zkl/z ZNxQSxoVaPgTALHm03bp6Xr73q2X2OqhdA== X-Google-Smtp-Source: ABdhPJwkp3XuarBVcVrXTVHxoiFQq8LITnmzf6AXBfVcJ25wdHLqd9Qb7WxgQraGmGYhP3qta0TXQA== X-Received: by 2002:aca:650d:: with SMTP id m13mr1002497oim.157.1623005263696; Sun, 06 Jun 2021 11:47:43 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id w69sm1795819oia.22.2021.06.06.11.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 11:47:43 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v2 try2 3/4] completion: bash: fix for multiple dash commands Date: Sun, 6 Jun 2021 13:47:25 -0500 Message-Id: <20210606184726.1018460-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.1.2.g0532ba4bf6 In-Reply-To: <20210606184726.1018460-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Otherwise commands like 'for-each-ref' are not completed. 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 05606609f9..1feb2ee108 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 Sun Jun 6 18:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12302151 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 4B872C4743D for ; Sun, 6 Jun 2021 18:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FECE61408 for ; Sun, 6 Jun 2021 18:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbhFFSus (ORCPT ); Sun, 6 Jun 2021 14:50:48 -0400 Received: from mail-oi1-f175.google.com ([209.85.167.175]:34357 "EHLO mail-oi1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbhFFSup (ORCPT ); Sun, 6 Jun 2021 14:50:45 -0400 Received: by mail-oi1-f175.google.com with SMTP id u11so15803505oiv.1 for ; Sun, 06 Jun 2021 11:48:45 -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=dQIVsqKg+XLtHZjqC+8SFiZMkY1JC8Xa6SEjMM6JtYs=; b=fbQdFE8G+G1VqAzExo3KHPFThWMxm1eyV6BJBmfph/JS7Nuv/3G1yQqoaVU/w47Mvn +o10ERDLIPn3qUoZCttWLBwWoFlBo8Kl57ksv6Kpk5k5w0tgI+S0AX9hv/2hWnNe7XTn vsThqcpHCf6drN9D0XPWS9KAGTBZYPujhGsbNsFhu/MocQF/fAQyAFbpO+xldlt0kq5T Oy3RTymP9H6inKDqDzok8HJ9ImpTMoWn4r3ZdKyEjQzmM7nX60FXr0ZDKFanfrGhZ6u7 NQusqESB0xI1HMb4tgGV2iGYn+NaUxBoFZbRNSK+5FVxiqLHbRXtE3JPOv4xsQrXX7Ye /oxw== 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=dQIVsqKg+XLtHZjqC+8SFiZMkY1JC8Xa6SEjMM6JtYs=; b=kIU7trknNE0Fv1OKcT15Qnmzysf8Dvtx2l3p036ALcst2XWS68ShwFHa2tQfv5O7P7 eSs+HiNLBS8QnClsvsm2Lvzl2eFIuN5Y5triZtc4lvi2c6ccAeOBUJacVESj/DYJFj2q 9YY3KwCH56K4rJnSZJmOy/fosv7QTAlAf/MJ2/gxwIu6sG4wyhbCoXsvETWnwX2bNuYV DND8zXSEcTIbei1vMYroed2AfGA/CgGhzvoAGGV/kTxF7mYQwG0//gGp6Ajm/R0M7pCc CoUT5/3rWoH9QFii1FkCZdSaU1IRsJCYQaNqAQfEdRItVnUiJE06Vct/96tgiiXdjYXE aZeA== X-Gm-Message-State: AOAM5311/cXc86fiMBrtvVud7DC4m2T+tg5ISOtMdjlfaTaXErSe+1KP TaDfU+c/cfTZKtRBC//Rs1DMemaTniw24w== X-Google-Smtp-Source: ABdhPJxQs1bcxYgCcQcFlzRdd09ETWOSGpAnBlHv8tZcoL4+H4PN23kwscLKZs8KPetEFPvSTOyq7w== X-Received: by 2002:aca:be8a:: with SMTP id o132mr16704718oif.3.1623005265275; Sun, 06 Jun 2021 11:47:45 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id z15sm1893311otp.20.2021.06.06.11.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 11:47:44 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v2 try2 4/4] completion: bash: add correct suffix in variables Date: Sun, 6 Jun 2021 13:47:26 -0500 Message-Id: <20210606184726.1018460-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.1.2.g0532ba4bf6 In-Reply-To: <20210606184726.1018460-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-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 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 1feb2ee108..c72b5465f9 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2652,7 +2652,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.*.*) @@ -2686,7 +2686,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.*.*) @@ -2702,7 +2702,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.*.*)