From patchwork Tue Jun 8 06:00:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12305431 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 D30BDC47082 for ; Tue, 8 Jun 2021 06:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B48886108E for ; Tue, 8 Jun 2021 06:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbhFHGDO (ORCPT ); Tue, 8 Jun 2021 02:03:14 -0400 Received: from mail-ot1-f54.google.com ([209.85.210.54]:43997 "EHLO mail-ot1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbhFHGDN (ORCPT ); Tue, 8 Jun 2021 02:03:13 -0400 Received: by mail-ot1-f54.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso19214921otu.10 for ; Mon, 07 Jun 2021 23:01:21 -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=Hhe1x6WBEFSZPKQCZzZOOCqB/UUvnG+vp3eAzoW/qXk=; b=MJB6fKdbDoz65aq/nl2N0DiB4St+qBHsB7ohzregSc5hMdJYTfD/XxyhHJzp6tcOeL QI2DmelqLPgvsVj2+bZ6rPF9MW06NXvpHpKGSq3mltsEsKG4+lGOyD5rsnec7BfJXz/Z JrkrQcrGqeBUAjK0M78U3Fhb+adbCknpBrvFSHQ4pK1f9mMOMvhRsKgbM+zusinciGL6 nG3LWoZBvMpYoiNZpmDtzxvuaajXkMaSRJ3dXg2SW4PbtKBI2VGxabZRpG9IpvlTd0kH X1NafNGIMGCgFnyXR6VTRjvnbG4tI6w95DdppsprBZCsqil82a2paXP/ral/0qR/3FB6 U/sQ== 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=Hhe1x6WBEFSZPKQCZzZOOCqB/UUvnG+vp3eAzoW/qXk=; b=gBIBkr9sCX/XP5vOH+RBo8UOvQ89k1uJ1b/Vj20TtVFjWcIKB4jNYGT5AaZ4Sm/xnk QCMGhdg8P/WjS1bYtcrzUQ/Zl6Zjwta+ecWnl5aiBSjIWAHg606aaqZT/ldux9NTQF9r 7a3eoMqukhJ137rJRfLJDJRgS5WdQGsBHWYWm719wtEP/yBiOV81vGPImvb3Q04fuEkK wpVT+ZnNOjhNQTVvV1qfc+JFC2zD9YbvSZtfXuq32MUXpK/UOxmpKafStNBhpGYgzqeW fcWck3682aLi9vw0kZ64kZWhVg62okBfqEcf/35I5iW5vTdO3gV8zSOSf3lLzpQDzE50 1dJw== X-Gm-Message-State: AOAM532f3zSp7Rn/o4vPzFzffspVQBbdpn0iYqhPxqkdoXABlEt6G/g6 VN0i8sy3nIw4wRWThkhdplaz8lYZl8u5jQ== X-Google-Smtp-Source: ABdhPJz3e6AEGrFW/LB3+VxM5EKf3/5TxZYxlD2VvueYdLvDJ23R1xdE/TCPUFjdcTuUtxd9C1DqRQ== X-Received: by 2002:a9d:b86:: with SMTP id 6mr14808295oth.340.1623132020970; Mon, 07 Jun 2021 23:00:20 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id a6sm2677080oon.20.2021.06.07.23.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 23:00:20 -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 v3 1/4] completion: bash: fix prefix detection in branch.* Date: Tue, 8 Jun 2021 01:00:07 -0500 Message-Id: <20210608060010.1676208-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210608060010.1676208-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-1-felipe.contreras@gmail.com> <20210608060010.1676208-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 Tue Jun 8 06:00:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12305427 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 AF5B7C47082 for ; Tue, 8 Jun 2021 06:00:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 956616128A for ; Tue, 8 Jun 2021 06:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbhFHGCQ (ORCPT ); Tue, 8 Jun 2021 02:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbhFHGCP (ORCPT ); Tue, 8 Jun 2021 02:02:15 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B10CAC061574 for ; Mon, 7 Jun 2021 23:00:23 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id u11so20521816oiv.1 for ; Mon, 07 Jun 2021 23:00:23 -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=TsBEh+k7PNgU3zRgE/MXn+0aQKaNCM5BdfpP+nGasBg=; b=MRO3HJ2l69hFKHDJVCbvmSGRwZS9vcIokMRS82TAswvrElk/Kh0slIKli3A3bImw1j hYEgVWriJz6OYsbnbK/Uw+zp2rOaA7cf0hmmtb/3IYfzQLSqc0xtuTuDGxnsVaM3tuVl XH0MUYBapLEr0WhtcyTHYkW4BUPMc27n7kp8Gf3Zrr5LBxb8O7Vevk1MD8KKB0oM3Sjn UOoGlCf+vJ5Pxunv1DfB9l2SbrDPuOfUZgkdsnGWk48yhon9x0Roe7brCx/7CPRZ7RDX BXedHshNka6j5v8AoDkz3eMn4NUyCYk0baj4g5sKFwgLxqFu91ZomCsBLAgCQ7KwKn3j 390A== 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=TsBEh+k7PNgU3zRgE/MXn+0aQKaNCM5BdfpP+nGasBg=; b=jZvmPAp3zqh0htjGBMXri/kuewc2LYR9gBkeou5rJTKFyhxfZLk5uWuNiG7zpiEaFe u1To9fcMhI9XYiysdE3hVDYzKPZBMCUc/seB0vY5vg/8UwDs3HmiPLO8KrRxWQwfwQJh urRupcGfcO3uW/HQWAmueFJbIk9L7N8deOw9LoHcSPY4DGIHoLvnfMYYJL2Aq6ROevnz wX/qBG+eH/hyrm9+Npg1BauQStKc+gC8AgvVZapuRL7YVrC9HX3ERfBtg08l1sqa9tHR kqYIJLxQ0bFTlu7SBevkn6nXUivtnCoTuMQJqL1GbmG9Tk32rddkVsCunSMYBDwVvJ1K 7WwA== X-Gm-Message-State: AOAM530kji6AuXfmKnoW+ZVxIPlhDS/Fu22Ng5r4vkORgeOVqG0TtQHd doUmI18xdlDkQTQEQkg4vZ+ogA3gWDICxw== X-Google-Smtp-Source: ABdhPJziJUCJMMA0YEGEquDJ9+7vLbm4lo/eySXTC+ArmZDVY3zNiZB46LYsu/DBwFz6ysBrAKmrpw== X-Received: by 2002:aca:4fd7:: with SMTP id d206mr1703057oib.16.1623132022892; Mon, 07 Jun 2021 23:00:22 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id w186sm2679992oib.58.2021.06.07.23.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 23:00:22 -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 v3 2/4] completion: bash: fix for suboptions with value Date: Tue, 8 Jun 2021 01:00:08 -0500 Message-Id: <20210608060010.1676208-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210608060010.1676208-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-1-felipe.contreras@gmail.com> <20210608060010.1676208-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 Tue Jun 8 06:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12305429 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 0E952C47082 for ; Tue, 8 Jun 2021 06:00:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7B5E61287 for ; Tue, 8 Jun 2021 06:00:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230190AbhFHGCh (ORCPT ); Tue, 8 Jun 2021 02:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbhFHGCg (ORCPT ); Tue, 8 Jun 2021 02:02:36 -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 BD434C061574 for ; Mon, 7 Jun 2021 23:00:26 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id t140so15255558oih.0 for ; Mon, 07 Jun 2021 23:00:26 -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=gUHBzJtvlaZgfjKMwZulc8xTVgtqmfc+Q79RqUXEtY0=; b=RPetCy+pKaAywhh1lqEgXdcObWPbAI4pq7muqrkbxpU3EKE+MUs+uEUAf7bhkeblsj 0JVAh5aM51nyxB/mWQI09u8gXNO722xpHrYTBTBV9bvGdlzOONB1s2xk0z4lCjG/qW2n 2egGmuuu8ITP91NC9ga5uI7pUdONwwDxGoQfJ5UXqn+cEzs2StwbFfmuhZlqGIr3hIup T5NX2xXc6DCyYxk+GJRrGWPK1eaN/gWYhymHOs0wj6cwbb91RTVAupqSqhKGI65EwecU z0y/fGMNT+/Gbga+IctS0HGSlrIZFsGvD/D5veIg0DeTjdgVCMYuj+P/UilqUnFygeE9 95QA== 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=gUHBzJtvlaZgfjKMwZulc8xTVgtqmfc+Q79RqUXEtY0=; b=VCXQE6KT1Wfd3sewVnlHHF5i1bKyBfgUbfnfNVeIy4OIYBDxiIdvvjCX/DwquzvQjx iRPNsvj4UVhLc9sTdUImq0d88zfWsYK2G7o5nUokNC/C/Iu7zr+xuJfOZBH5okqPyDca 2W1qp95ZzWOEf6CjDIob6PGEeYsP1gCsmO7VouDx+p0IC2caC/5+AMfMh9VzAFdragBY rFQlj2jK2aAvmcXo9SekZ2mfPtWSx6u6dqjIiU2sN4odPW4b0TDYIl3Y4LhmD2cn6gM9 Rov7VEZ9bd5jwgtFw2IELP3t4HPwFh26sG9r3JvdoKivdHD5xf1QDu1K59H7T2XVtJvG xkgg== X-Gm-Message-State: AOAM531GA5gGBUcgTyzuBbiIXrXOJFsjIrrsm19u+OWLo9M7yA4oTOM+ RmpaCm+w5RSyf+spX+zzXtupFH/sWhQqZQ== X-Google-Smtp-Source: ABdhPJy6/hh+uZOxP1NFNyVhDYna64gq4LFS+0nntK1z/T2gljvSManG0ZEu7Pn5ln2R1tCQRAujkw== X-Received: by 2002:a54:4d8b:: with SMTP id y11mr1783229oix.26.1623132024326; Mon, 07 Jun 2021 23:00:24 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id p204sm2650911oia.43.2021.06.07.23.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 23:00:24 -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 v3 3/4] completion: bash: fix for multiple dash commands Date: Tue, 8 Jun 2021 01:00:09 -0500 Message-Id: <20210608060010.1676208-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210608060010.1676208-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-1-felipe.contreras@gmail.com> <20210608060010.1676208-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 Tue Jun 8 06:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12305433 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 B6B66C47082 for ; Tue, 8 Jun 2021 06:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8326961108 for ; Tue, 8 Jun 2021 06:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbhFHGDV (ORCPT ); Tue, 8 Jun 2021 02:03:21 -0400 Received: from mail-oi1-f181.google.com ([209.85.167.181]:46033 "EHLO mail-oi1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbhFHGDT (ORCPT ); Tue, 8 Jun 2021 02:03:19 -0400 Received: by mail-oi1-f181.google.com with SMTP id w127so20477579oig.12 for ; Mon, 07 Jun 2021 23:01:26 -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=Y31lWlpplvd4owJMF1sOGObRVW/efTHEkQOeVeSM9JA=; b=EjQYiMk1HxudPZFl6AAKrFZl5zp2LNXiUjlq2S3yhhIiwXSP76s4z2bmVm6I/3nWQX g9o79lYKd7C/KcZC4AC9rBMp2yC2knD+PIJJ4dBbM42Zx+7rdUYtRFE1pn7VVb3hOSJx tiIWhL4mKvOL4Sc3kcywIQ3GnKLIsQU8Yh/FcbL5OKpB0uTht9fitqxKrVN4YDvZKzBs CM0KPNyico8Uw+t3EflV+r+7ky/fzR+ghk9B1ami6/AZIpa+a0KB07zBs7szBnRzbSsy M8oTOzbSLprDuEgsexnLiK8nyHLnajtO0BbSb6lC/xM/v74Ijney7C7Rwyk0mxF9KcWR Bfew== 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=Y31lWlpplvd4owJMF1sOGObRVW/efTHEkQOeVeSM9JA=; b=MzhptRvNzhRiMFMfqzj8exX6FefpA13VTamRJ2maUhfM28U5W3o45/SRiAFCxNjDzr i5Pm62qfDC7ahMSyT+8vY0z1WBdPLvU7n6Di7bx/MsPjE64HbqkNuTILHjPSGP1qcej1 4W6xaB7ATY1Ff9Gfg7ZGl8nda/GsNq9Pj9/WGz57GVuOMh2Yjpc1VhyD6j1RSdFygqVm 1PwwCQI4a/89CEXc0REwP3QH3PL9UGXEkyY8HM5dhNzSDzOcdB0NN6NBUga1B0LxsYBo xJmMw9dO8wIl5RVMXKFpb5aFSC/SL1wgG6XqLSE7Tx0UXm2HuHQsA4/mSXzU2el9NEsJ BDSQ== X-Gm-Message-State: AOAM533z3h2Q52GK9RXWsO/PK4PIVmkYmEZiH6PIBlx3Um4NW4xZHjzx hsdWp0QLNOx/d50UQUw61IHgCWL3pVja2A== X-Google-Smtp-Source: ABdhPJy2XgVF9CG5CWtd6fm79pZq0NwnqTNegSK8jfrv4bfzwdds9PNIDf1QfFrGtEk/hbHp6CG6OA== X-Received: by 2002:a54:448a:: with SMTP id v10mr1824807oiv.133.1623132025866; Mon, 07 Jun 2021 23:00:25 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id t26sm2930902oth.14.2021.06.07.23.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 23:00:25 -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 v3 4/4] completion: bash: add correct suffix in variables Date: Tue, 8 Jun 2021 01:00:10 -0500 Message-Id: <20210608060010.1676208-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210608060010.1676208-1-felipe.contreras@gmail.com> References: <20210606184726.1018460-1-felipe.contreras@gmail.com> <20210608060010.1676208-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.*.*)