From patchwork Mon Jun 14 04:34:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12318069 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.7 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 B6E2BC48BE8 for ; Mon, 14 Jun 2021 04:35:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9378F613AB for ; Mon, 14 Jun 2021 04:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbhFNEhL (ORCPT ); Mon, 14 Jun 2021 00:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbhFNEhK (ORCPT ); Mon, 14 Jun 2021 00:37:10 -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 3C25DC061756 for ; Sun, 13 Jun 2021 21:34:55 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id w22-20020a0568304116b02904060c6415c7so7283492ott.1 for ; Sun, 13 Jun 2021 21:34: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=j7ZSuW9x9OmNV7z5Ql8p19f7S8Lv2OqDgczi6ChLIpE=; b=UoaNo0OKgIQqFoMgIc2AF0Q1+jZ2RTVKiYEnqbvWjxHmMRUGhOCcD1JSaF3/b/EVGX ScIFjc3kkrMtL/fJPeA8CK+5mqlhr+w6EgvQp6YJQCYRj86yuR+wjKc7Ilee0xMr3sKm QcS12je8/tjCDChDOR1ulbWlE6Tnd7kW2YExE5AdYy2O+ISZeXcYSHPvqaJLODr1o5l+ rSRfJWhHfr8sElYxF8s4xtqa2TPKbARZL8ylEORByxU0dmgwaQKD7w2aaaj6fSxTIBAf E7G8sjXli5OKDzpquTxP9D0UobTdisuZwziNiIdMkqbv7Rze23Cvcvi05lJeQVr81hiu /b4A== 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=j7ZSuW9x9OmNV7z5Ql8p19f7S8Lv2OqDgczi6ChLIpE=; b=l2IK6eUS3PuNZgHnp0Iq4QOeZyhkzKicSSAKnnSgqihyGH23ARrFcQsx5g9ZJumcZy ob4rmRXE5SCKMDPYFPYFpX4jF14Z/TKjFKfe/8RVRLCM3+SKRkY+hn4G2BTJgcjaF9JQ 5b11rIXVFwEM1Vfc1Eonqj+S/fUQF//D144HGEiIWWjdncXeRE8HDpShlU9+J+XQxtxB jQ85AIoMsQqjg/WoQOahCsgnbrzWQq7SM0uFEbdAP0vIPaM/kFkEWjkfP3IHLvCxTVcf fuRxvphff81mXNJSkalACWSVdw3djv4uUHCl+FQIXSv9EqGP5ysRIa8FZid9Dei+yk1E jlRA== X-Gm-Message-State: AOAM531dfrd5um0MtMGyIqZGztvhmT4f8+cytn8fXiK/js7M0Il3X3LM FAghKKPj0r/YW6E13hm1PmxBhmn9M1VTyQ== X-Google-Smtp-Source: ABdhPJwhW62p2ZhWUQHN3hc5GMYpX0Scee2w2539ObMb74icyqz+NPblhSFOneZ+0cpoTejuElLMAQ== X-Received: by 2002:a9d:5a15:: with SMTP id v21mr12378109oth.112.1623645294341; Sun, 13 Jun 2021 21:34:54 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id n127sm2699345oif.55.2021.06.13.21.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jun 2021 21:34:54 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Luke Shumaker , Junio C Hamano , Felipe Contreras Subject: [PATCH 1/2] completion: graduate out of contrib Date: Sun, 13 Jun 2021 23:34:49 -0500 Message-Id: <20210614043450.1047571-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614043450.1047571-1-felipe.contreras@gmail.com> References: <20210614043450.1047571-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org These have been stable and widely used for quite a long time, they even have tests outside of the contrib area, and most distributions ship them, so they can be considered part of the core already. We should be consistent and either we move the tests to contrib, or we move the completions out of contrib. Let's move them out of contrib and provide an installation target install-extra. By default bash-completion installs the completions to $(pkgdatadir)/completions, which is $(prefix)/share/bash-completion/completions. And since most distributions do not change this, it is obviously the right default that distributions can override with bashcompdir. By default zsh looks for completions in $(prefix)/share/zsh/site-functions. Signed-off-by: Felipe Contreras --- Makefile | 3 +++ extra/Makefile | 17 +++++++++++++++++ .../completion/git-completion.bash | 0 .../completion/git-completion.zsh | 0 {contrib => extra}/completion/git-prompt.sh | 0 t/t9902-completion.sh | 8 ++++---- t/t9903-bash-prompt.sh | 2 +- 7 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 extra/Makefile rename {contrib => extra}/completion/git-completion.bash (100%) rename {contrib => extra}/completion/git-completion.zsh (100%) rename {contrib => extra}/completion/git-prompt.sh (100%) diff --git a/Makefile b/Makefile index c3565fc0f8..5bb03808b3 100644 --- a/Makefile +++ b/Makefile @@ -3105,6 +3105,9 @@ quick-install-man: quick-install-html: $(MAKE) -C Documentation quick-install-html +install-extra: + $(MAKE) -C extra install + ### Maintainer's dist rules diff --git a/extra/Makefile b/extra/Makefile new file mode 100644 index 0000000000..26d8be55b0 --- /dev/null +++ b/extra/Makefile @@ -0,0 +1,17 @@ +bashcompdir = $(sharedir)/bash-completion/completions + +DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) +sharedir_SQ = $(subst ','\'',$(sharedir)) +bashcompdir_SQ = $(subst ','\'',$(bashcompdir)) +gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir)) + +INSTALL ?= install + +all: + +install: install-completion + +install-completion: + $(INSTALL) -D -m 644 completion/git-completion.bash '$(DESTDIR_SQ)$(bashcompdir_SQ)'/git + $(INSTALL) -D -m 644 completion/git-prompt.sh '$(DESTDIR_SQ)$(sharedir_SQ)'/git-core/git-prompt.sh + $(INSTALL) -D -m 644 completion/git-completion.zsh '$(DESTDIR_SQ)$(sharedir_SQ)'/zsh/site-functions/_git diff --git a/contrib/completion/git-completion.bash b/extra/completion/git-completion.bash similarity index 100% rename from contrib/completion/git-completion.bash rename to extra/completion/git-completion.bash diff --git a/contrib/completion/git-completion.zsh b/extra/completion/git-completion.zsh similarity index 100% rename from contrib/completion/git-completion.zsh rename to extra/completion/git-completion.zsh diff --git a/contrib/completion/git-prompt.sh b/extra/completion/git-prompt.sh similarity index 100% rename from contrib/completion/git-prompt.sh rename to extra/completion/git-prompt.sh diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index cb057ef161..32601b755d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -36,7 +36,7 @@ complete () GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr rebase ls-files' GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout rebase' -. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" +. "$GIT_BUILD_DIR/extra/completion/git-completion.bash" # We don't need this function to actually join words or do anything special. # Also, it's cleaner to avoid touching bash's internal completion variables. @@ -2383,14 +2383,14 @@ test_expect_success 'git clone --config= - value' ' test_expect_success 'sourcing the completion script clears cached commands' ' __git_compute_all_commands && verbose test -n "$__git_all_commands" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_BUILD_DIR/extra/completion/git-completion.bash" && verbose test -z "$__git_all_commands" ' test_expect_success 'sourcing the completion script clears cached merge strategies' ' __git_compute_merge_strategies && verbose test -n "$__git_merge_strategies" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_BUILD_DIR/extra/completion/git-completion.bash" && verbose test -z "$__git_merge_strategies" ' @@ -2399,7 +2399,7 @@ test_expect_success 'sourcing the completion script clears cached --options' ' verbose test -n "$__gitcomp_builtin_checkout" && __gitcomp_builtin notes_edit && verbose test -n "$__gitcomp_builtin_notes_edit" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_BUILD_DIR/extra/completion/git-completion.bash" && verbose test -z "$__gitcomp_builtin_checkout" && verbose test -z "$__gitcomp_builtin_notes_edit" ' diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index bbd513bab0..784e523fd4 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -10,7 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./lib-bash.sh -. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" +. "$GIT_BUILD_DIR/extra/completion/git-prompt.sh" actual="$TRASH_DIRECTORY/actual" c_red='\\[\\e[31m\\]' From patchwork Mon Jun 14 04:34:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12318071 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.7 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 ABD9AC48BE8 for ; Mon, 14 Jun 2021 04:36:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8300D61283 for ; Mon, 14 Jun 2021 04:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbhFNEiO (ORCPT ); Mon, 14 Jun 2021 00:38:14 -0400 Received: from mail-oi1-f170.google.com ([209.85.167.170]:39510 "EHLO mail-oi1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbhFNEiO (ORCPT ); Mon, 14 Jun 2021 00:38:14 -0400 Received: by mail-oi1-f170.google.com with SMTP id m137so13091170oig.6 for ; Sun, 13 Jun 2021 21:35:56 -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=mj7l7sgW83TyvYXZvUOI7p02FijEOH8JesSKjL4fhW4=; b=SHidLSSFbR7M5S9uU0y7sMbMiUCHthUdZp0z7Qi9fhEF7li1p48lCNP65CeC4p5IkI 5jgoQLjZTMhAbGlH2Dlgdw4QujorQRiJwnoJyZJ/45yIz+4qe21f1QlnaUTqbse1XIXA w7BMIMCy3MKgMUlvOBADANGTqfZ0TVn00qjbgEX5tkA+qGc9bzSMM8PCYiw7LAAYUY0X aXbIRXvhHNWMTnugn9H0SkacEYep2KEvbLRblih2xr/38iR+SUkax3rCGTzI4C8eB53n +dgM+yVSD7t/V0XUk+EF4iGEeHtt3h3mLldw+E1h5ogDkdEyriDP4RAIz9zY2rmAgmp6 BXnA== 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=mj7l7sgW83TyvYXZvUOI7p02FijEOH8JesSKjL4fhW4=; b=dCw8Maku8NSlzTa1/Z2RdXFG7NkihgkV0jAm6B/lIY7VHfP8GWMtoLUAOYgy2LcUU3 ow7aGXTRNLF5NEB6t4/iSZmlRT1blQd2y3IlD24U+lQogq+ucpkeYbBfqtzjb+R8rQs1 15wfsJ34IvxRqLsh+qqZ7MDmyojz495RKCkiUWy7gu7g1Ndh+2a9hB7dxH7aZ9SFpcDV pZVxwaaWTHQzGHn1YQ4RhRHaddipCZXEPIY/dPOsS5oZJVPu3PCmAb+FjmB7UgcCBay+ pL2nqC4e7+LfdTkrxbeQ6FxKw1jYJjLfuPGVRqN/d0Xo1bMTrVODsluFGRpXqsVKtYsi zd2g== X-Gm-Message-State: AOAM531BQiiiz+6SY/xo0ATtYUh5kxhW8KEu+R6dUaVWeQoaeao3o+S8 t77d6qypluAzHep5UmmsOGpzpjTzKrNESg== X-Google-Smtp-Source: ABdhPJybbB6CQ0Jjlf+4ZgmRRhMNUHhkneCTQmOkZw3f25yOD8EaalYOMdhuAEmGkoqFV3WSEgTiuA== X-Received: by 2002:aca:c349:: with SMTP id t70mr15198238oif.153.1623645295792; Sun, 13 Jun 2021 21:34:55 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id l18sm3021110otr.50.2021.06.13.21.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jun 2021 21:34:55 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Luke Shumaker , Junio C Hamano , Felipe Contreras Subject: [PATCH 2/2] git-new-workdir: graduate out of contrib Date: Sun, 13 Jun 2021 23:34:50 -0500 Message-Id: <20210614043450.1047571-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614043450.1047571-1-felipe.contreras@gmail.com> References: <20210614043450.1047571-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- extra/Makefile | 5 ++++- {contrib => extra}/workdir/.gitattributes | 0 {contrib => extra}/workdir/git-new-workdir | 0 t/t1021-rerere-in-workdir.sh | 6 +++--- t/t3000-ls-files-others.sh | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) rename {contrib => extra}/workdir/.gitattributes (100%) rename {contrib => extra}/workdir/git-new-workdir (100%) diff --git a/extra/Makefile b/extra/Makefile index 26d8be55b0..66a1cdcdf4 100644 --- a/extra/Makefile +++ b/extra/Makefile @@ -9,9 +9,12 @@ INSTALL ?= install all: -install: install-completion +install: install-completion install-workdir install-completion: $(INSTALL) -D -m 644 completion/git-completion.bash '$(DESTDIR_SQ)$(bashcompdir_SQ)'/git $(INSTALL) -D -m 644 completion/git-prompt.sh '$(DESTDIR_SQ)$(sharedir_SQ)'/git-core/git-prompt.sh $(INSTALL) -D -m 644 completion/git-completion.zsh '$(DESTDIR_SQ)$(sharedir_SQ)'/zsh/site-functions/_git + +install-workdir: + $(INSTALL) -D workdir/git-new-workdir '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'/git-new-workdir diff --git a/contrib/workdir/.gitattributes b/extra/workdir/.gitattributes similarity index 100% rename from contrib/workdir/.gitattributes rename to extra/workdir/.gitattributes diff --git a/contrib/workdir/git-new-workdir b/extra/workdir/git-new-workdir similarity index 100% rename from contrib/workdir/git-new-workdir rename to extra/workdir/git-new-workdir diff --git a/t/t1021-rerere-in-workdir.sh b/t/t1021-rerere-in-workdir.sh index 0b892894eb..035a92c0e7 100755 --- a/t/t1021-rerere-in-workdir.sh +++ b/t/t1021-rerere-in-workdir.sh @@ -27,7 +27,7 @@ test_expect_success SYMLINKS setup ' test_expect_success SYMLINKS 'rerere in workdir' ' rm -rf .git/rr-cache && - "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . work && + "$SHELL_PATH" "$TEST_DIRECTORY/../extra/workdir/git-new-workdir" . work && ( cd work && test_must_fail git merge side && @@ -38,12 +38,12 @@ test_expect_success SYMLINKS 'rerere in workdir' ' ' # This fails because we don't resolve relative symlink in mkdir_in_gitdir() -# For the purpose of helping contrib/workdir/git-new-workdir users, we do not +# For the purpose of helping extra/workdir/git-new-workdir users, we do not # have to support relative symlinks, but it might be nicer to make this work # with a relative symbolic link someday. test_expect_failure SYMLINKS 'rerere in workdir (relative)' ' rm -rf .git/rr-cache && - "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . krow && + "$SHELL_PATH" "$TEST_DIRECTORY/../extra/workdir/git-new-workdir" . krow && ( cd krow && rm -f .git/rr-cache && diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index 740ce56eab..86240a1b98 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -84,7 +84,7 @@ test_expect_success SYMLINKS 'ls-files --others with symlinked submodule' ' ) && ( cd super && - "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" ../sub sub && + "$SHELL_PATH" "$TEST_DIRECTORY/../extra/workdir/git-new-workdir" ../sub sub && git ls-files --others --exclude-standard >../actual ) && echo sub/ >expect &&