{"thread":{"id":"36618","subject":"[PATCH v2] completion: graduate out of contrib","startedAt":"2014-05-09T03:53:07Z","lastAt":"2014-05-09T03:53:07Z","messageCount":1,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"241098","messageId":"1399607587-14127-1-git-send-email-felipe.contreras@gmail.com","threadId":"36618","inReplyTo":null,"subject":"[PATCH v2] completion: graduate out of contrib","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-09T03:53:07Z","receivedAt":"2014-05-09T03:53:07Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"These have been stable and widely used for quite a long time, they even\nhave tests outside of the contrib area, and most distributions ship\nthem, so they can be considered part of the core already.\n\nWe should be consistent and either we move the tests to contrib, or we\nmove the completions out of contrib.\n\nLet's move them out of contrib and install them by default.\n\nBy default bash-completion installs the completions to\n$(pkgdatadir)/completions, which is\n$(prefix)/share/bash-completion/completions. And since most distributions do\nnot change this, it is obviously the right default. However,\nbash-completion recommends to use pkg-config to find the right location,\nso we could use that, but it's much easier to let distributions do it:\n\n  bashcomdir=$pkg-config --variable=completionsdir bash-completion)\n\nBy default zsh looks for completions in\n$(prefix)/share/zsh/site-functions.\n\nThe distributions use these locations to install Git completions:\n\n  ArchLinux: /usr/share/bash-completion/completions/\n  Debian: /usr/share/bash-completion/completions/\n  Fedora: /etc/bash_completion.d/\n  Ubuntu: /usr/share/bash-completion/completions/\n  Mint: /usr/share/bash-completion/completions/\n  OpenSuse: /etc/bash_completion.d/\n\nHowever, in both Fedora and OpenSUSE their bash-completion intallations\nuse /usr/share/bash-completion/completions/ (they don't change the\ndefault). So it  seems to a be a bug from the packager, since they\nrecommend the bash-completion location[1]\n\nIf some weird distribution has a problem with the location, they can\noverride 'bashcompdir' anyway.\n\n[1] http://article.gmane.org/gmane.linux.redhat.fedora.devel/177405\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Makefile                                           | 6 ++++++\n {contrib/completion => shared}/git-completion.bash | 0\n {contrib/completion => shared}/git-completion.zsh  | 0\n {contrib/completion => shared}/git-prompt.sh       | 0\n t/t9902-completion.sh                              | 2 +-\n t/t9903-bash-prompt.sh                             | 2 +-\n 6 files changed, 8 insertions(+), 2 deletions(-)\n rename {contrib/completion => shared}/git-completion.bash (100%)\n rename {contrib/completion => shared}/git-completion.zsh (100%)\n rename {contrib/completion => shared}/git-prompt.sh (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 52bdc95..2690903 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -379,6 +379,7 @@ gitwebdir = $(sharedir)/gitweb\n localedir = $(sharedir)/locale\n template_dir = share/git-core/templates\n htmldir = $(prefix)/share/doc/git-doc\n+bashcompdir = $(sharedir)/bash-completion/completions\n ETC_GITCONFIG = $(sysconfdir)/gitconfig\n ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes\n lib = lib\n@@ -1582,6 +1583,8 @@ template_dir_SQ = $(subst ','\\'',$(template_dir))\n htmldir_relative_SQ = $(subst ','\\'',$(htmldir_relative))\n prefix_SQ = $(subst ','\\'',$(prefix))\n gitwebdir_SQ = $(subst ','\\'',$(gitwebdir))\n+sharedir_SQ = $(subst ','\\'',$(sharedir))\n+bashcompdir_SQ = $(subst ','\\'',$(bashcompdir))\n \n SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))\n PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n@@ -2345,6 +2348,9 @@ install: all\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'\n \t$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'\n+\t$(INSTALL) -D -m 644 shared/git-completion.bash '$(DESTDIR_SQ)$(bashcompdir_SQ)'/git\n+\t$(INSTALL) -D -m 644 shared/git-prompt.sh '$(DESTDIR_SQ)$(sharedir_SQ)'/git-core/git-prompt.sh\n+\t$(INSTALL) -D -m 644 shared/git-completion.zsh '$(DESTDIR_SQ)$(sharedir_SQ)'/zsh/site-functions/_git\n ifndef NO_GETTEXT\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'\n \t(cd po/build/locale && $(TAR) cf - .) | \\\ndiff --git a/contrib/completion/git-completion.bash b/shared/git-completion.bash\nsimilarity index 100%\nrename from contrib/completion/git-completion.bash\nrename to shared/git-completion.bash\ndiff --git a/contrib/completion/git-completion.zsh b/shared/git-completion.zsh\nsimilarity index 100%\nrename from contrib/completion/git-completion.zsh\nrename to shared/git-completion.zsh\ndiff --git a/contrib/completion/git-prompt.sh b/shared/git-prompt.sh\nsimilarity index 100%\nrename from contrib/completion/git-prompt.sh\nrename to shared/git-prompt.sh\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 2d4beb5..d8674e4 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -32,7 +32,7 @@ complete ()\n \n GIT_TESTING_COMMAND_COMPLETION='add checkout check-attr filter-branch ls-files'\n \n-. \"$GIT_BUILD_DIR/contrib/completion/git-completion.bash\"\n+. \"$GIT_BUILD_DIR/shared/git-completion.bash\"\n \n # We don't need this function to actually join words or do anything special.\n # Also, it's cleaner to avoid touching bash's internal completion variables.\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 6efd0d9..59d2cb9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -7,7 +7,7 @@ test_description='test git-specific bash prompt functions'\n \n . ./lib-bash.sh\n \n-. \"$GIT_BUILD_DIR/contrib/completion/git-prompt.sh\"\n+. \"$GIT_BUILD_DIR/shared/git-prompt.sh\"\n \n actual=\"$TRASH_DIRECTORY/actual\"\n c_red='\\\\[\\\\e[31m\\\\]'\n-- \n1.9.2+fc1.27.gbce2056\n"}]}