Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477920 - dev-vcs/git: 'git-prompt' is not really a bash-completion file
Summary: dev-vcs/git: 'git-prompt' is not really a bash-completion file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 15:56 UTC by Michał Górny
Modified: 2014-04-12 08:59 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-23 15:56:51 UTC
$ qlist git | grep bash-complet
/usr/share/bash-completion/completions/git
/usr/share/bash-completion/completions/git-prompt

However, git-prompt doesn't seem really intended for bash-completion. The instructions on top of it say:

#    1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
#    2) Add the following line to your .bashrc/.zshrc:
#        source ~/.git-prompt.sh
#    3a) Change your PS1 to call __git_ps1 as
#        command-substitution:
#        Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

So you always need to modify prompts to use it. I'd suggest simply leaving it off in some random directory and pointing user towards it, asking him to follow the instructions.
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2014-02-04 09:39:16 UTC
+  04 Feb 2014; Lars Wendler <polynomial-c@gentoo.org> git-1.8.1.5.ebuild,
+  git-1.8.1.5-r1.ebuild, git-1.8.2.1.ebuild, git-1.8.4.5.ebuild,
+  -git-1.8.5.2.ebuild, git-1.8.5.3.ebuild, git-9999.ebuild,
+  -files/git-1.7.12-git-svn-backport.patch, +files/git-daemon-r1.initd:
+  Added rewritten init script which no longer contains "need net" (bug
+  #490446). Added epatch_user (bug #497292). Added www-servers/nginx to the
+  list of server who work with git-instaweb (bug #491862). Removed reference to
+  no longer needed patch in remaining ebuilds. Removed old files and ebuilds.
+  Don't install git-prompt.sh as bash-completion file (bug #477920).
+
Comment 2 Mira Ressel 2014-02-05 08:55:01 UTC
I don't think this was a good idea. What advantages did it have to remove the git-prompt script? Sure, it is not a bash-completion script, but *it is used just like one* - some users want it sourced in their shell sessions.

At least the script was not removed completely from the ebuild - but still, dodoc'ing is inferior to the status quo. User who want to use it will either have to decompress the file and copy it somewhere appropriate or to add "sh" to PORTAGE_COMPRESS_EXCLUDE_SUFFIXES.

Why all it needless complexity? The status quo did work fine for all users, both those who want the script and those who don't want it. Wasn't this just removing for removal's sake, without any technical reasons?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-02-05 15:48:07 UTC
(In reply to Luis Ressel from comment #2)
> Why all it needless complexity? The status quo did work fine for all users,
> both those who want the script and those who don't want it. Wasn't this just
> removing for removal's sake, without any technical reasons?

If it did work fine for *all* users, why did I report this bug?
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2014-02-05 19:16:44 UTC
It should not go into bash-completion directory, which is /usr/share/bash-completion/completions, which is intended for autoloaded completion files
at upstream level
Our bash-completion is currently special, and is deviating from upstream's, but that doesn't mean nobody is running the autoloading -version (upstream version)

So by all means, install the script, but just put it somewhere else, like /usr/share/git/ or such, from where user can then source it when he wants
Comment 5 Markus Oehme 2014-02-06 22:49:41 UTC
This just had me searching a bit. I think a better warning may be nice. Also the old location is still referenced in the ebuild 'einfo "Please read /usr/share/bash-completion/git-prompt for Git bash prompt"'.
Comment 6 Tanktalus 2014-02-07 18:32:54 UTC
This is not a bug and should be reverted.  The instructions on top of "git" say nearly the same thing as on top of "git-prompt":

#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
#    2) Add the following line to your .bashrc/.zshrc:
#        source ~/.git-completion.sh
#    3) Consider changing your PS1 to also show the current branch,
#       see git-prompt.sh for details.

So, the user is expected to copy it (oh hold on, that's what the ebuild does for them, nice!), add something to their .bashrc (oh hold on, that's what eselect is, more or less, doing for them, on request, nice!), and then continue and do something else (but portage isn't doing the considering for the user, ah well, can't win 'em all).

By installing it in usable form (not compressed), it means that as the user upgrades git, new shells will automatically get the updated prompt (assuming any fixes are applied).  The new method means that users must remember to update their prompt script every time, even if it hasn't changed, just in case it has changed.

Please revert.  It worked fine for all users.  There was no problem actually reported in this bug report, just some distaste for non-purism.  Yes, it's not an "autocompletion" - but it otherwise fits in fine with eselect bashcomp as something users can add or remove at their whim.  And it's both *convenient* and *managed* (fixes are applied appropriately) and thus seems to fit in quite well there with Gentoo's overall philosophies.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-02-07 19:07:52 UTC
(In reply to Tanktalus from comment #6)
> Please revert.  It worked fine for all users.  There was no problem actually
> reported in this bug report, just some distaste for non-purism. [...]

The behavior of eselect is going to be changed to meet the workflow of new bash-completion. It will no longer work with this script.
Comment 8 Julien Sanchez archtester 2014-02-19 15:13:42 UTC
I fully agree with Michał that 'git-prompt' is not a bash-completion file. But as Luis and Tanktalus said, it is a real pity for users who actually use it and want to keep it always up to date.

Would it be possible to not install it with dodoc but put it elsewhere in executable form? Then just add an einfo to tell the user that it's up to him to source that file.
Comment 9 Lukas Hrazky 2014-04-12 08:59:03 UTC
I've created a new bug #507480 to resolve the issue of bzipped git-prompt.sh in a doc directory.