From patchwork Wed Jul 7 02:31:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12361433 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 4CB6CC07E96 for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25CD361C9C for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbhGGCee (ORCPT ); Tue, 6 Jul 2021 22:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhGGCea (ORCPT ); Tue, 6 Jul 2021 22:34:30 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95C35C061574 for ; Tue, 6 Jul 2021 19:31:50 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 7-20020a9d0d070000b0290439abcef697so841548oti.2 for ; Tue, 06 Jul 2021 19:31:50 -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=grkVnHHNxlk0usj7rU4StYPs3+LnYPTEkJdi52Yc7RU=; b=UoDXuMeCLhEtu+L7gD+zLKdWwJNb5JxrrJg5TlYSkRi6SbThhBii8vRVny8PKRFN2n O2rZfQ9drYCgeGRPCWsvQ9Yg5ZSoUHCo+H72HZHC8FnlTE5nYeZgclVlTlQL0vs92DBq qJjvkjAWhbYs5lPkxQjKfKjuReXhf+nSoa8LtCQ0J73QDtPMgEghPBERMjvyWg2xwGub zjDlBNnAykWFeBzpJhlRY1nPYpNwkS5JG2CGu9trV5UAXtE89cascSMfoo5IC9BGn86u vzQHDPkrTK5h6A8ixrPDOrtERjHkoj6InKyJiqx1eASE371cuYkBocfc93uZpcSDPZAg ifVQ== 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=grkVnHHNxlk0usj7rU4StYPs3+LnYPTEkJdi52Yc7RU=; b=gt2KNLMSp+cBu1VnsQMWS/SDrp5fhiEw50YUjcjIQI0Bk59bHQObnmwbWslEk1sYS0 4ibvSH9akbRAlnAPw8mv2W7HCxXyZf3eqBZvfNEmcMozJtWKE492UhJff9/hZCEIj/5s pLrjnSiUQwSPIqSiwayDvK3MRbfQgCdp+7jwzT2syIBEoFl+x+9PTOeLGZJMwgou+JER 487wtXRRSdV2ldJkWNrmuojL87OPEycEVMoeKka++tPKP96Lk45fOPLGtxOzk9DXQbr4 XxB4nGUp63ateKHpwU5B52wIVKOuuRlnBynkdXsUV5/mZpPAF5I0FbkK9A82guoWox4D uyjA== X-Gm-Message-State: AOAM533MpvRpJRY+N9R7NgEu0y07GSr4hnvYwOYTZvPuBKUulRgBc76K 4fbn3Yh+5uYHbTtbaTC1bQZULAsZgec= X-Google-Smtp-Source: ABdhPJz8T7/ZHnN/NxYnT5wsxc94SKx7OUbac9zJo3Nhl11F2RZxxDLBLoBbIooQ7O3W8MXbpnrDpw== X-Received: by 2002:a9d:7b56:: with SMTP id f22mr17123566oto.71.1625625109788; Tue, 06 Jul 2021 19:31:49 -0700 (PDT) Received: from localhost (fixed-187-189-163-231.totalplay.net. [187.189.163.231]) by smtp.gmail.com with ESMTPSA id 91sm3030074oty.73.2021.07.06.19.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 19:31:49 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , David Aguilar , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v5 1/4] completion: bash: fix prefix detection in branch.* Date: Tue, 6 Jul 2021 21:31:43 -0500 Message-Id: <20210707023146.3132162-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.36.g70aac2b1aa In-Reply-To: <20210707023146.3132162-1-felipe.contreras@gmail.com> References: <20210707023146.3132162-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 Wed Jul 7 02:31:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12361435 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 4EAB9C07E9B for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3285B61CA2 for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbhGGCef (ORCPT ); Tue, 6 Jul 2021 22:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbhGGCed (ORCPT ); Tue, 6 Jul 2021 22:34:33 -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 885BFC061574 for ; Tue, 6 Jul 2021 19:31:52 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id b2so1701247oiy.6 for ; Tue, 06 Jul 2021 19:31:52 -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=QrnsAeUe83T3jTXKML1epgqqWssAt8hSEjd5QDbWyJw=; b=iK8x+8Cj3oWR8/e3DTgAFsTko2ntZIXj11X9VnjCnQSxmR6EgafTandhz5UwT2inHI +k7UeSqyqaSn6bsA4zuFktOEZ321ka6gn0PFgYsO7Jw4LpmItQ8qCbhhw3QgkFQ9J+uh /RJUY1u2lMYHrzihvFtxyb913bHTx6CX+FUj/ci4QlflULLfkUn8lvRa1ySm0HNg6+27 djjsFKvZWjHL/VnPKG5HXOVgqe68ToH/SnjTS5f8dVtrcYLlPVgk1YkCSf84CfY+U25k x1PP5vF07g3JJ9CbKQzX3sB8R7g2/SB4qXuAEbCO+iaMG1cb2WxhBcNSvpLKo+TWXdN0 sCoA== 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=QrnsAeUe83T3jTXKML1epgqqWssAt8hSEjd5QDbWyJw=; b=p8cGierSKlCCXlGSQyjsazUopjqJiZFGvLY/UmRjGmCG4AlNRSYmk5W/G+ofrhsf1W Wb9dfsgpvUyVDTHaZHML5+u3AZkzZkF+R40RUN5eQld9UgelngWEp7Q+g2yzrZ7Wr8I2 316sqgcrYzCq8uOC64xi7KWoyZZn4zLmlbii39gpj5S+f1h5gINN43P323e3dPo72qBv LqHU2+4a8qwVSz2yhwWrUXIVunwGEG0VO8uomG90htinD+JCwPNMeI+uCZ8+rh5p8ALn ErWU9Rqag5E6klLyhzrLO0u52jU0PVPbXOVljlfY1iL9OoshgDqASg+0W9sE0aFXCsYx FHdg== X-Gm-Message-State: AOAM531lCxZi1rZDsTU3vIQM+UJ40R7gy+CZJNNtMfgzYZA1fQlT2TL2 xoIbdurQt0+Bm4VKNpc+Ko1ZnO25wj8= X-Google-Smtp-Source: ABdhPJzgqHqf10hBsKlg8M42EqoBCTC7qglkX/xo+RjDuATU4HYZHVEaKceswMTR9e2hwNvi6QT63g== X-Received: by 2002:a05:6808:2105:: with SMTP id r5mr2989925oiw.57.1625625111775; Tue, 06 Jul 2021 19:31:51 -0700 (PDT) Received: from localhost (fixed-187-189-163-231.totalplay.net. [187.189.163.231]) by smtp.gmail.com with ESMTPSA id a16sm2588102oiy.17.2021.07.06.19.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 19:31:51 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , David Aguilar , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v5 2/4] completion: bash: fix for suboptions with value Date: Tue, 6 Jul 2021 21:31:44 -0500 Message-Id: <20210707023146.3132162-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.36.g70aac2b1aa In-Reply-To: <20210707023146.3132162-1-felipe.contreras@gmail.com> References: <20210707023146.3132162-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 Wed Jul 7 02:31:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12361437 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 6C2B0C07E9C for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A68561CAA for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbhGGCef (ORCPT ); Tue, 6 Jul 2021 22:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbhGGCee (ORCPT ); Tue, 6 Jul 2021 22:34:34 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC45C06175F for ; Tue, 6 Jul 2021 19:31:54 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id 7-20020a9d0d070000b0290439abcef697so841673oti.2 for ; Tue, 06 Jul 2021 19:31:54 -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=JuykJGXW2IoV62Ky5yvn5UIC10MTAqFTdOSI2+8lGcw=; b=RDd4SqDnLRhH34m3aQKOh1tnO9l75W7gNHJ0xDifS7MbUw5Deq2dhIo2K1Eqzs/fFY nTOm+ZXhtZ59eBlN9h2gWbjEe93na3hkksPi7d9lRUyZVaBGPi4q4LYy3vTHVw1NQ8Vk jLIbxKJLYHUYaFFB6yesELFr0ZpEpI8SxdHPkX7WbrilL2njsdiQhWkkbPTagU/b2KZK kH4qxsvo+aD1nuRe3A6FInBwIbo8lWLo/RLS0g2XndhIkLC2H+NAVAL253936rBp4UXU nvHEUe7n50hqTZ+RrjBMGvGt4GBYPTGZx1Fd4q6ScdvWZnZzt2/hQH3dqcyiDWyhpli7 9dTw== 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=JuykJGXW2IoV62Ky5yvn5UIC10MTAqFTdOSI2+8lGcw=; b=lwnS9U4mSTFYTjP+LMdBBCpCHLLNLzACtjTVhascrGj0Kfc3bCJYxoWAa+lPxXFAx4 GZjbLmT0pxMIxKFK2bcJMrejDsQvmAF3ay4Us4iIbJWB1nhL8Q9eXP5cC+RIuZ9vUmlc MPg3cbk4W1HcB36R4dlDJWYLtSVrxqIUXzUoERsfPvlHqasahiGyVo8d4fGp0Lls5AFD dzdJNrcHZ2TnK1OwdNuYQgldudIMo9pDSkIEH4RInv+S9erf6bqEhXP0jpUNelVbDOG2 Q0kZbQ0elCwc9SyQ0Fxq9FinLyNAAwst7TU5FunbnfsDh7U0hEGACsBN3DkHACJam2pn WUmg== X-Gm-Message-State: AOAM530M630Qi38jlzVWRj3Yq7YDOMGRT8M2EoeTqWKT0DI7q01UdsjU rnSfgXItGLC56ecg1FdZtKBt3L93T60= X-Google-Smtp-Source: ABdhPJwZjdzehsW1p3+hr3TY7/ra6UN3owqQmYtDSgMWnUUHIr/L/ovXziFv0uFHLFf5+u9bNIvHvw== X-Received: by 2002:a9d:585:: with SMTP id 5mr17909222otd.12.1625625113245; Tue, 06 Jul 2021 19:31:53 -0700 (PDT) Received: from localhost (fixed-187-189-163-231.totalplay.net. [187.189.163.231]) by smtp.gmail.com with ESMTPSA id 91sm3030102oty.73.2021.07.06.19.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 19:31:52 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , David Aguilar , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v5 3/4] completion: bash: fix for multiple dash commands Date: Tue, 6 Jul 2021 21:31:45 -0500 Message-Id: <20210707023146.3132162-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.36.g70aac2b1aa In-Reply-To: <20210707023146.3132162-1-felipe.contreras@gmail.com> References: <20210707023146.3132162-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 Wed Jul 7 02:31:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12361439 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 6C966C11F66 for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5800E61CA2 for ; Wed, 7 Jul 2021 02:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbhGGCej (ORCPT ); Tue, 6 Jul 2021 22:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbhGGCeg (ORCPT ); Tue, 6 Jul 2021 22:34:36 -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 A6FFAC061574 for ; Tue, 6 Jul 2021 19:31:55 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id h9so1714155oih.4 for ; Tue, 06 Jul 2021 19:31:55 -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=p27hd21DJnwP13hTjgQmrNWzILLH6vxTLByRzwYj+g4=; b=fP4N1nx3t8lkg5w14IeTdccMmIqyH4nv3BMIrhwMAgdUbV+ZIjCkvmhW5DcbVmhCdi o2ac9UkzG05zDtskHveiPIV0Ss0a62X+7cWY/a77BHFavkxjxERdqB/Ytsh8vHUobv4g kzsFittJ0WQnukl3/k51+i9sP3Exn2PO+kVTCqgEHVv7FFr2Z8vJlIhr5GxPFAWv2P3W AEoDQwcXtbXQde2edjVdzq/1fiDoJ53bXSKml9z7Z5mrZIrDbGrvKJputNhffxyxZJXJ DotxrZKMxqX2ezoNliL/YpUzMQmaLAlB7QQjqSGeW/k24qIc8UgZem/0VUzMNrEOhpho ESYw== 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=p27hd21DJnwP13hTjgQmrNWzILLH6vxTLByRzwYj+g4=; b=Tc0boeygqwsyFh6X7hgVb+O77HfrFzZMFjfat9g+KV9kBI+3z1sX3+uq2gHJu9J/ag YuFtqiriwfvGKPGO/vk9Vn3v8BCr+U6DeeUD93SfnFst+F+9fW7E9P+zvoFUiMWowS+a 4ti9YwZ6joLCz9/cpt4Dj/gjZaFQ1II+vNIaaApa7/Ev+gwUHoGwjXiOZiFWvZPCHKuz D9ObqHZmqN01/Ij0l+Ew/gRbs2nU7NanYiHdmeVMgGyA/mLK0NFJRpMjOpU0WtvGFMvx tSsvUTDaNeGYQ1QZmqlEu60McMDFgxwMJjMlUfl8O05EyDn9VgFp6uVUyXlqaABSdAqV 3+vw== X-Gm-Message-State: AOAM53118FftBmsyroxTGX6u1dlJLijSaW0oH/lWCXhsqImsdRCyrtrA ZDH1aF0F01DFytb/lAt7LH+KMG0mhFk= X-Google-Smtp-Source: ABdhPJxV8s+n1JBmz8AHp9BsAwFwWybwuNCSZGuPRibMeoxW6N3ob73UDQxRBFgoM7IhhMelbHuw1A== X-Received: by 2002:a05:6808:1312:: with SMTP id y18mr17012198oiv.82.1625625114895; Tue, 06 Jul 2021 19:31:54 -0700 (PDT) Received: from localhost (fixed-187-189-163-231.totalplay.net. [187.189.163.231]) by smtp.gmail.com with ESMTPSA id n26sm3231623oos.14.2021.07.06.19.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 19:31:54 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , David Aguilar , =?utf-8?q?SZEDER_G=C3=A1bor?= , Felipe Contreras Subject: [PATCH v5 4/4] completion: bash: add correct suffix in variables Date: Tue, 6 Jul 2021 21:31:46 -0500 Message-Id: <20210707023146.3132162-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.36.g70aac2b1aa In-Reply-To: <20210707023146.3132162-1-felipe.contreras@gmail.com> References: <20210707023146.3132162-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.*.*)