Bug 212303

Summary: devel/git: install bash-completion so it can be used directly
Product: Ports & Packages Reporter: Aleksander Alekseev <afiskon>
Component: Individual Port(s)Assignee: Renato Botelho <garga>
Status: Closed FIXED    
Severity: Affects Many People CC: adamw, afiskon, garga, mat, michael.osipov
Priority: --- Flags: bugzilla: maintainer-feedback? (garga)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Aleksander Alekseev 2016-09-01 09:17:10 UTC
I would be nice if shells/bash-completion also include completion for git out of the box.

Currently user have to add it manually like this:

```
cd /usr/local/share/bash-completion/completions/
sudo wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O git
```

git-completion.bash is a very powerful thing. Not only `git me[Tab]` completes to `git merge` but also `git checkout optional_prefix_[Tab]` suggest branch names and remotes, and stuff like that.
Comment 1 Aleksander Alekseev 2016-09-01 09:21:11 UTC
As a side note, port probably could use a set of Ubuntu's completion scripts instead of Debian's. It already includes git completion and probably other scripts.
Comment 2 Mathieu Arnold freebsd_committer freebsd_triage 2016-09-01 09:42:33 UTC
Mmmm, you don't need to go and fetch it from the web, if you install git, it is available in /usr/local/share/git-core/contrib/completion/git-completion.bash.

It would be nice if git installed it at the right place though.
Comment 3 Aleksander Alekseev 2016-09-01 10:59:50 UTC
I'm using git-lite binary package. Apparently it doesn't include bach completion. Interestingly it doesn't look much lighter than regular git package (+24 Mb, a few additional Perl modules, nothing fancy). Maybe I should just use it instead of git-lite.
Comment 4 Mathieu Arnold freebsd_committer freebsd_triage 2016-09-01 13:04:49 UTC
Created attachment 174287 [details]
patch

The patch does two things:

- split targets so that they use options helpers when possible
- Always install the completions to some useful place.
    if CONTRIB is on, symlink them in the right place.
    if CONTRIB is off, copy the anyway.
Comment 5 Adam Weinberger freebsd_committer freebsd_triage 2016-09-01 14:01:05 UTC
CONTRIB has lots of build-time dependencies, and I don't think that having completions should depend on them. If the completions are going to be installed, why not just install them into the right place always?
Comment 6 Adam Weinberger freebsd_committer freebsd_triage 2016-09-01 14:03:53 UTC
Also, Aleksander, can you please file a separate PR about comment #1, switching to the Ubuntu completion scripts? Along with some links if you have them. Thanks.
Comment 7 Adam Weinberger freebsd_committer freebsd_triage 2016-09-11 21:04:50 UTC
Oh, I misread mat's patch. It does the right thing. I definitely vote in favour of applying mat's patch. Renato, do you have input/opinion here?
Comment 8 Adam Weinberger freebsd_committer freebsd_triage 2016-11-15 03:04:45 UTC
Renato can you give an up or down vote on Mat's patch please?
Comment 9 Mathieu Arnold freebsd_committer freebsd_triage 2016-11-15 08:43:19 UTC
Oh, I had forgotten about this one, committed.
Comment 10 commit-hook freebsd_committer freebsd_triage 2016-11-15 08:43:25 UTC
A commit references this bug:

Author: mat
Date: Tue Nov 15 08:43:10 UTC 2016
New revision: 426150
URL: https://svnweb.freebsd.org/changeset/ports/426150

Log:
  Split targets so that they use options helpers when possible.
  Always install the completions to some useful place. [1]
    if CONTRIB is on, symlink them in the right place.
    if CONTRIB is off, copy the anyway.

  PR:		212303
  Submitted by:	mat
  Reported by:	Aleksander Alekseev [1]
  Approved by:	maintainer timeout
  Sponsored by:	Absolight

Changes:
  head/devel/git/Makefile
  head/devel/git/pkg-plist