From: Felipe Contreras <felipe.contreras@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Felipe Contreras" <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Luke Shumaker <lukeshu@lukeshu.com>,
Junio C Hamano <gitster@pobox.com>,
Philippe Blain <levraiphilippeblain@gmail.com>
Subject: Re: [PATCH v3 1/1] completion: graduate out of contrib
Date: Fri, 16 Jul 2021 15:14:01 -0500 [thread overview]
Message-ID: <60f1e88949659_3302085e@natae.notmuch> (raw)
In-Reply-To: <87zgumyd7w.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> On Thu, Jul 15 2021, Felipe Contreras wrote:
> > Ævar Arnfjörð Bjarmason wrote:
> >> On Thu, Jul 15 2021, Ævar Arnfjörð Bjarmason wrote:
> >> > On Wed, Jul 14 2021, Felipe Contreras wrote:
> >> >> [...]
> >> >> @@ -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\\]'
> >> >
> >> > It's more of a "for bonus points", but a nic way to round-trip this
> >> > would be to make this work with GIT_TEST_INSTALLED.
> >> >
> >> > I.e. source these relative to GIT_EXEC_PATH, not $GIT_BUILD_DIR, I think
> >> > that just sourcing them as e.g.:
> >> >
> >> > . git-completion.bash
> >> >
> >> > But the GIT_TEST_INSTALLED case is tricker, maybe we'd need to add a
> >> > "git --share-path" :(
> >>
> >> I forgot to include this not-working patch, i.e. I've got no idea what
> >> the "something" should be other than the harder thing of compiling
> >> "sharedir" into git and making "git --share-path" work.
> >
> > I don't think there's a "something" that would make sense.
> >
> > It would be something like '/opt/git/bin/completion'?
>
> I think more importantly if they're going to be "first-class" components
> that we have some native way of getting them to the user.
Yes, I already said --share-path would make sense [1] in your other
reply.
> I.e. once you install git being able to load them in your shell as:
>
> . git-path
> . git-completion
>
> Or whatever, which means either putting them in $PATH (i.e. we'd drop
> them in bin/ along with the non-dashed-built-ins like git-upload-pack
> etc.), or something like:
>
> . "$(git --completion-path)"/bash
> . "$(git --completion-path)"/zsh
>
> Or maybe:
>
> . "$(git --extras-path)"/completion/bash.sh
> . "$(git --extras-path)"/prompt.sh
>
> ?
But that's not how completions should work.
There's a standard location for bash completions in order to be picked
by bash-completion:
/usr/share/bash-completion/completions
This will be the case regardless of what --extras-path is.
The user *should not* be sourcing anything from there directly,
bash-completion does that automatically.
This location depends by distribution, and the standard way to figure it
out is:
pkg-config --variable=completionsdir bash-completion
If you don't have bash-completion insalled, *then* you would need to
source the completion file directly, but you cannot use pkg-config to
figure out that location, so you would need to use the default
(/usr/share/bash-completion/completions).
We could install the completion twice (or provide a symlink):
/usr/share/bash-completion/completions/git
/usr/share/git-core/completion/bash.sh
So if the user doesn't have bash-completion installed, can do:
source "$(git --extras-path)"/completion/bash.sh
Instead of the standard:
source /usr/share/bash-completion/completions/git
But *right now* the standard location is standard, distributions are
using it, and users are using it.
Moreover, it seems a bit wasteful to have --exec-path, --html-path,
--man-path, --info-path, --extra-path. Why not have --path=extra
instead?
Once again, I think this is a good idea, but it should be done
separately, and you yourself said "for bonus points".
Not to mention my strong feeling that *even* if I implement this nice
feature, Junio will still ignore this series (as he ignores everything I
send), so I will be simply wasting my time implementing something that
will never be merged (just like he stood on the sidelines watching us
implement 6 versions of the man pager colorize patch just to say "no
thanks" [2]).
I'd be more than happy to add any other suggestions you might have, but
let's be honest: this is a patch we all will have be carrying ourselves
(I have dozens of those), so I'd rather not add more complexity for a
perfect solution that won't be applied.
I'd rather aim for something that is good enough.
Cheers.
[1] https://lore.kernel.org/git/60f0859399369_519c2083c@natae.notmuch/
[2] https://lore.kernel.org/git/xmqq4ke8pig9.fsf@gitster.g/
--
Felipe Contreras
next prev parent reply other threads:[~2021-07-16 20:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-10 23:46 [PATCH v2 0/2] extra: new concept of extra components Felipe Contreras
2021-07-10 23:46 ` [PATCH v2 1/2] completion: graduate out of contrib Felipe Contreras
2021-07-10 23:46 ` [PATCH v2 2/2] git-new-workdir: " Felipe Contreras
2021-07-12 17:43 ` [PATCH v2 0/2] extra: new concept of extra components Philippe Blain
2021-07-12 17:55 ` Felipe Contreras
2021-07-13 0:17 ` Junio C Hamano
2021-07-13 1:19 ` Felipe Contreras
2021-07-14 20:23 ` [PATCH v3 0/1] " Felipe Contreras
2021-07-14 20:23 ` [PATCH v3 1/1] completion: graduate out of contrib Felipe Contreras
2021-07-14 23:03 ` Ævar Arnfjörð Bjarmason
2021-07-14 23:17 ` Ævar Arnfjörð Bjarmason
2021-07-15 19:12 ` Felipe Contreras
2021-07-16 6:36 ` Ævar Arnfjörð Bjarmason
2021-07-16 20:14 ` Felipe Contreras [this message]
2021-07-15 18:59 ` Felipe Contreras
2021-07-16 20:14 ` [PATCH v4 0/1] extra: new concept of extra components Felipe Contreras
2021-07-16 20:14 ` [PATCH v4 1/1] completion: graduate out of contrib Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60f1e88949659_3302085e@natae.notmuch \
--to=felipe.contreras@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=levraiphilippeblain@gmail.com \
--cc=lukeshu@lukeshu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).