From patchwork Fri Jun 21 22:31:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11010791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD5DC14B6 for ; Fri, 21 Jun 2019 22:31:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E58928B7B for ; Fri, 21 Jun 2019 22:31:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 918AF28BAB; Fri, 21 Jun 2019 22:31:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D0BA28B7B for ; Fri, 21 Jun 2019 22:31:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfFUWba (ORCPT ); Fri, 21 Jun 2019 18:31:30 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:43869 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfFUWb2 (ORCPT ); Fri, 21 Jun 2019 18:31:28 -0400 Received: by mail-ot1-f65.google.com with SMTP id i8so662320oth.10 for ; Fri, 21 Jun 2019 15:31:28 -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=ZO7yby0/XVxCyPkgiYHbmca//TbCCBrhLrSjteLUtqM=; b=YIu/ngVFqFm4o696Ie6uwL4/LhXIRumaQ+nrKj4m3tVw/SDfbgUJTjXKTc9MP2T5G+ Cm0isRbARI+kODIUaBGw5/yaMZqE7v/CzWMyDdz+jhXESCwJtC0Cd2IsP8V4x27MdByi Wta/acB54tqvIVyUS1lGrEnjFO0zw6gLAGuVCFuBB3t4bgoqreNF/egHccg/PYwBg0YL Hptc1TqzLfAzdpF9lt9Bskn6wWXbi8BDlgj6tw2xDAoqCKowRt/au0k4hpvKCron/zIn bict3F5b83xGSFPW9fx71C3G8Mtwm+XQpI36R/pV+XRF5lkyG2Fpq6YeDk2Jr91EFzbJ U/oQ== 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=ZO7yby0/XVxCyPkgiYHbmca//TbCCBrhLrSjteLUtqM=; b=Lvd3kv7w6UcE1zifnvydDNFsgHvboK8ZzPpSVtZM1W3i68BXgjFezp1I3BS/okkhfg 36qC8wrfXiLZ4X8nvY/2augZ2hxeodSx9k/OklGQNaRVtOYZsRT1eYz5UB1ULVobNGkr Ids2JcUcFw0IikSWaJqi42xcReCFyUdnhTT41vRINcD3clkIwmAkyJlxy6vU8H0olt6/ 7eC6kxx5B0ZextfpdajYAMEjpURJyPhK2EEyEUoKaksR0+ZVhE7qWZ4BpwG7Nip1nDiL ylggdaqsP5DkD888CrcCIqw6rXNSY89R+CFVMC/uBFyUeLjAfp3XTg2+EBTR0cn8s443 sxSA== X-Gm-Message-State: APjAAAULHGrqWEZjwGZ8dryWzRRGim9OPfsufb78H09MAD1BZHjOvOEc kRTnAYq1sH8fComHzHao6+eoxvv5hRo= X-Google-Smtp-Source: APXvYqyo0caBgmdNoqYAIsJzUwKbiu8/D5od+8QBlPQIryGh6rqjp7hnQ4IlkXk7PENEQxDJ/k4oEw== X-Received: by 2002:a9d:7ccb:: with SMTP id r11mr40005877otn.80.1561156287558; Fri, 21 Jun 2019 15:31:27 -0700 (PDT) Received: from localhost (200-52-42-156.reservada.static.axtel.net. [200.52.42.156]) by smtp.gmail.com with ESMTPSA id a4sm1466470otp.72.2019.06.21.15.31.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 15:31:27 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , =?utf-8?b?Tmd1eQ==?= =?utf-8?b?4buFbiBUaMOhaSBOZ+G7jWMgRHV5?= , Felipe Contreras Subject: [PATCH 14/14] completion: add default merge strategies Date: Fri, 21 Jun 2019 17:31:07 -0500 Message-Id: <20190621223107.8022-15-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190621223107.8022-1-felipe.contreras@gmail.com> References: <20190621223107.8022-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case the command fails. Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 4 +++- t/t9902-completion.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 922ba5f925..91b87eb558 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -936,6 +936,7 @@ __git_list_merge_strategies () }' } +__git_merge_strategies_default='octopus ours recursive resolve subtree' __git_merge_strategies= # 'git merge -s help' (and thus detection of the merge strategy # list) fails, unfortunately, if run outside of any git working @@ -945,7 +946,8 @@ __git_merge_strategies= __git_compute_merge_strategies () { test -n "$__git_merge_strategies" || - __git_merge_strategies=$(__git_list_merge_strategies) + { __git_merge_strategies=$(__git_list_merge_strategies); + __git_merge_strategies="${__git_merge_strategies:-__git_merge_strategies_default}"; } } __git_merge_strategy_options="ours theirs subtree subtree= patience diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 14598bfbec..f4453ce70d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1722,7 +1722,7 @@ test_expect_success 'sourcing the completion script clears cached commands' ' verbose test -z "$__git_all_commands" ' -test_expect_failure 'sourcing the completion script clears cached merge strategies' ' +test_expect_success 'sourcing the completion script clears cached merge strategies' ' offgit && GIT_TEST_GETTEXT_POISON= && __git_compute_merge_strategies &&