From patchwork Thu Jun 17 14:35:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12328035 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 1F78AC2B9F4 for ; Thu, 17 Jun 2021 14:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0064861406 for ; Thu, 17 Jun 2021 14:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbhFQOhl (ORCPT ); Thu, 17 Jun 2021 10:37:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbhFQOhj (ORCPT ); Thu, 17 Jun 2021 10:37:39 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E731C061574 for ; Thu, 17 Jun 2021 07:35:31 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id d19so6748809oic.7 for ; Thu, 17 Jun 2021 07:35:31 -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=4T+EJLf4Ceh1ssFeIo8IWSBtRXtHLXqpgec0mvEHDjQ=; b=ZvnT6GfOKcQcvF3pPmuYB4t+nXx7AuuLoZav8wFwf4aWR3lGrDsTGqR1mIx2zGQldl a1Nl/2kP1fVtT45h75P3/59sq5ABEkjdPinW91TRV7N+EBbeXUat9uyM5i0q+Hr+HcT/ 9rxC4Za9HR473C1tunHq1SDjIg8HeKznsNd4HiJsGThHAAikQwsSvwAw+dNyWPTLOLml nkUEMNreREoOSYh0fU4uMGtMMcHPExUaiu/NmIB3UcTkOhvoXuXO8VElpqv6C1XsRC3v JS+OM75lB0kDiemDeHvBJmfBsMVe2vJmYwDACbKh6EfODzbKWRokfpDKSYur+ttUTj8O Tn1Q== 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=4T+EJLf4Ceh1ssFeIo8IWSBtRXtHLXqpgec0mvEHDjQ=; b=eD9lSXIMSAX1eWNihO0CcR+WMfW60FsYiG8qtAARmdd9YgTWSWyTmRSKT2IRAqi6yD 2solYq67QQ2752aZfhVU1uvQN0ijN6QWdlQU/pBgLdeUY7uV18TKk4YHdYlBaxdFtJzP IyLm74B1UnRKpI5S4308wjSpfaoLZQlyxGtORTpDRYRgt0W3385NzGFc+FpOlCyKHeWP raf+TlmZe8Y5zyQyWJQmo/1MkNeD/9EqfbsD6kZNp75wzL7zjuYQcApW6JziWZmo83y7 pwyfnk55VoO5D0o0MOh3DxK195/guI7v/hZutSdNlOMoI59/ZFvJhSQAy4M5Bsotu7nL z2SQ== X-Gm-Message-State: AOAM531D2eRD/bxXkxmfn0o7xJ3KO7qWp1ug7I62HOTKz/ZTgOLJ3flp ZiH9nPzuNAhFOmphzrHpTTjNinW613SyqQ== X-Google-Smtp-Source: ABdhPJx/D1kiZ5VShvdK46SSdMvso+95G4dPX9qCna9U8hr2OfTQDvhwdI4qIN5gdvuopSpCOHeSDg== X-Received: by 2002:a05:6808:20a0:: with SMTP id s32mr10682304oiw.94.1623940530676; Thu, 17 Jun 2021 07:35:30 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id p17sm1283425otp.73.2021.06.17.07.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 07:35:30 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras , David Aguilar Subject: [PATCH v4 1/4] completion: bash: fix prefix detection in branch.* Date: Thu, 17 Jun 2021 09:35:24 -0500 Message-Id: <20210617143527.77329-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210617143527.77329-1-felipe.contreras@gmail.com> References: <20210617143527.77329-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 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 Thu Jun 17 14:35: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: 12328037 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 167D9C2B9F4 for ; Thu, 17 Jun 2021 14:35:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1A5F61405 for ; Thu, 17 Jun 2021 14:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232837AbhFQOho (ORCPT ); Thu, 17 Jun 2021 10:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbhFQOhm (ORCPT ); Thu, 17 Jun 2021 10:37:42 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C27AC061574 for ; Thu, 17 Jun 2021 07:35:33 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id s23so6734340oiw.9 for ; Thu, 17 Jun 2021 07:35:33 -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=Cy3WP75DjFgSdHbIbldKJvfuf4B4avPb0n6FTHa9Cf8=; b=cuCqvM6jJJ+tBEjr6bOl0gctkMXLRG4rzC3L8dGPjxpkR1W6nuPeTUExaosFaFsFph +oFnX0cnNOB6FaPDzgs16tJ0fnG92n73Wt+Sxv+qu3Mx73CDcOwmvNuLv5MOC4X8tF7Y iMAZ2tcsvK399jBfUNC1Uq1iUO38pzK2gc8+IUKMQwcz1IK47IiFLslACugrEKA/9Nzd l0/ohXuDqWAWqDTZBfWIVafrmk4Fx+fUcMOqzLqlEXuWR3zsRmQU/N/ct0oHdsBXH6g3 BPC7WYmgMZBxHFqlzCgvWw//y8E0mnTEbannG1vlk4YXnmCIaEIfuiFcimjwmfZ1lhyf Iq9A== 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=Cy3WP75DjFgSdHbIbldKJvfuf4B4avPb0n6FTHa9Cf8=; b=SsVl3zg75hmofnHWHG4tQmgXqwkBS0l3mfiRGVZxT5SYQHy/lJHpPlHebCLeEGC5KB msEZ9DdiNdE9/3o+BSzO/d2hVjbjMoLe5b7vcXDGY+pBeDn5jL3ggfRsyp6CvYjyk7Px OosbwSvMbxVhtDPW+krY7L6OY+kOIJJ7uFn0LrNFlusO2qzXUvCnLdn9gTwtXTVUQ4Xp AfWOZ2NSHTUfqK8qPXr2Ytc2DV+GO0AZgLCZU5XarjJxGjOB5LAsFLURQiM5ya5QK/Uo DschhvLjqs23hie6uL7TCwbeHf5VweX8UGzgVfYIA1BEo16eSGG97ScR04oDVEzW3QN6 TL9Q== X-Gm-Message-State: AOAM532zzii/LkJH+Zvir7EK0EqFy2T47l5HxD6d/7dZ385fjUwq1a4+ M/Ckic8aXlOWagCvax6wsqRy9WPEDuO+5Q== X-Google-Smtp-Source: ABdhPJy253ysvhPqRPnt1CoB7JISNlzLuRZDOjmE1LH4PP/U0y87+t2bSyaj+0II4T0iUTK85H2oMQ== X-Received: by 2002:aca:3bc5:: with SMTP id i188mr3619053oia.72.1623940532437; Thu, 17 Jun 2021 07:35:32 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id e29sm1147180oiy.53.2021.06.17.07.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 07:35:31 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras , David Aguilar Subject: [PATCH v4 2/4] completion: bash: fix for suboptions with value Date: Thu, 17 Jun 2021 09:35:25 -0500 Message-Id: <20210617143527.77329-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210617143527.77329-1-felipe.contreras@gmail.com> References: <20210617143527.77329-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 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 Thu Jun 17 14:35:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12328039 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 EF25CC49361 for ; Thu, 17 Jun 2021 14:35:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D77A261405 for ; Thu, 17 Jun 2021 14:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbhFQOhp (ORCPT ); Thu, 17 Jun 2021 10:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232827AbhFQOhm (ORCPT ); Thu, 17 Jun 2021 10:37:42 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC689C061760 for ; Thu, 17 Jun 2021 07:35:34 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id w23-20020a9d5a970000b02903d0ef989477so6306705oth.9 for ; Thu, 17 Jun 2021 07:35: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=t6n/adBdXcMs+fient3frCGWLqZWu05GW2wtPddQtGY=; b=f+einu2dpdnASoLm0yukovu1a73KQ8EFATNDFYQ7Kdu8Oa4b9expYhJjRJmIU1VlHK 0a9685LS25xM8tZ/7cjzWmFawJnR06m7of54AxjUrnXsKbzMor3bg6n5mkUFHp07iHoS BMFyOHFL8d9GZgK80yoj50M8ffBEFGBvmISr8ASDApogDPaJ9CUdqX7NX9/ck0lLKLfN Jlynj1HDlRq52GfcCtxEZw7bGYL1fCVAeen1dyxyF0AulA6g3hv2wDHVQw/6MJvflL3d PbRfHli+QE8wlC1w4W5gAsTWVkNQaHD37RtSAEOyHKbN6wo3vZaUrBeoLcN/oe1GPYaI +Ggg== 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=t6n/adBdXcMs+fient3frCGWLqZWu05GW2wtPddQtGY=; b=ITMdbUIynuq39HI2GTEYA5novPUj4xcTuEFCQqth0lQ1+eWSrXOlXVU9/ftWhJjGmO DIOfEWItH63g5L1zqoRQQB3XPSUQX+kL7xzBKumwcEal4xrUjRWA6RHc0j2Vq4PdkMes WaR8GsZFUoWolr1/l/+K2OJthmT8N8v+1KeqCgdsfn0fnBxuWdaYr8QdwvJT1jjVj6RI Cga6IjU8jbVcD5az6Rms944lVzf1ri0SRls+o52V3/oo5FgG6KH/GVSvLxy3AdpwBnKW rJk4T8HsRGYSBy0T4AFPsPfaY/uS+8OF1n4r/Y4pg4nxglpaH0J7xK3HjV6eKuSFZf+/ +rug== X-Gm-Message-State: AOAM532FoTKYqdke2Nh7BPDFwDCithup7+iQWy1QcGIVfzQ2kTUMNiIO VyXzVLa1Xlud8gXjNNVpwT7OQv/dNulKEw== X-Google-Smtp-Source: ABdhPJxLyiy/K466i0vkFo4EXZzrCL5MZUbETM3Uwxws7+YbH8+ImM4Ajvz9lEusJLftS5xBd5sIcA== X-Received: by 2002:a05:6830:190:: with SMTP id q16mr4791690ota.34.1623940534140; Thu, 17 Jun 2021 07:35:34 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id o2sm1135127oom.26.2021.06.17.07.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 07:35:33 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras , David Aguilar Subject: [PATCH v4 3/4] completion: bash: fix for multiple dash commands Date: Thu, 17 Jun 2021 09:35:26 -0500 Message-Id: <20210617143527.77329-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210617143527.77329-1-felipe.contreras@gmail.com> References: <20210617143527.77329-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 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 Thu Jun 17 14:35:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12328041 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 24522C2B9F4 for ; Thu, 17 Jun 2021 14:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A60C61405 for ; Thu, 17 Jun 2021 14:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbhFQOhq (ORCPT ); Thu, 17 Jun 2021 10:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbhFQOho (ORCPT ); Thu, 17 Jun 2021 10:37:44 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7621C06175F for ; Thu, 17 Jun 2021 07:35:36 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id 6-20020a9d07860000b02903e83bf8f8fcso6305081oto.12 for ; Thu, 17 Jun 2021 07:35:36 -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=xt88Sy5Ry8SFkmg/EQSfciNYdk0rwBHLDh7nPEHF6nU=; b=VFnixkG9bU6ODhehLzlR0YvYLicLMJjXOcqavfLvgi/0eXsp+cmk5BL7mC9IRaFViG XpagrWlo9q6+wqyEzOyPt1fUijpgaxLoIYvtSPY0aCaAlF6pEdK2FH16AiPg/2faTc/i HUtYWtx8GuwVHzPt6wLSsXkyVw4fHEdaw1e2HmUcnmkDbEKc9AXI5f/m2NquYTUp+kue q4KDQZEbufxBIC2l26Vs5cz0+ShSdvrkGBfMcokaCk+fZ+rqjEMS3mef1gK+OT3xhT+1 9vNj4ekuOkiqrndiV2ECHa/XDM3yZ/K5i5Rm0xkan56entWCw27Lhqy18bP1oXrVcj3d eoLg== 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=xt88Sy5Ry8SFkmg/EQSfciNYdk0rwBHLDh7nPEHF6nU=; b=Z18MeXp4MtEVeb41vacc3PqmVC7WrOmlXINjfRAecKt5HHdrJMYZJzYH5q7sGuUWju kaIOjQ8Y/AJREWnSJZEoXVD7/f9Lzo51yFK6/6n2PRAI3YU7qS4JZZTR+GaotpLdRUvf kl3phON9eVnmvf57YIYjGIT68qBpcAl7He1zixtDAz7D/bXDTOcH2/Uv1ZyZT7IAGosn eyKn9nyeiy0U0NvRtxuJYDpqVP9FLAf4ppXJPpy+WndRnZRLW1CDzy/6c6ornYl7AHHS IDQygZvCk5Zk5gRWOuDBgINjUih7UtK81vh9k4SlQqpA0RmazHCoOwF0YTiGZg5jAvqY Zz6A== X-Gm-Message-State: AOAM533pps5jl5CO3+j3Fq3AQHHsk97Ik86oUHqEyCez7Lh2DuexYCgT 8R1h2a7b0mawRbt+7FC4bZIXTZ2MytAoug== X-Google-Smtp-Source: ABdhPJy2VGcgZWysjVElzhLP6eP1XQMEJZIJaHNbCPE0t74bJxKb4aa9uJ03RaUPTKc//zZasnmncA== X-Received: by 2002:a9d:6291:: with SMTP id x17mr4818295otk.326.1623940536044; Thu, 17 Jun 2021 07:35:36 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id q26sm434562ota.20.2021.06.17.07.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 07:35:35 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras , David Aguilar Subject: [PATCH v4 4/4] completion: bash: add correct suffix in variables Date: Thu, 17 Jun 2021 09:35:27 -0500 Message-Id: <20210617143527.77329-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210617143527.77329-1-felipe.contreras@gmail.com> References: <20210617143527.77329-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 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.*.*)