Skip to content

Commit 29c9aee

Browse files
committed
Merge branch 'ps/install-bash-completion'
Build update to install bash (but not zsh) completion script. * ps/install-bash-completion: contrib/completion: install Bash completion
2 parents 87b0875 + fe35ce2 commit 29c9aee

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ prefix = $(HOME)
615615
bindir = $(prefix)/bin
616616
mandir = $(prefix)/share/man
617617
infodir = $(prefix)/share/info
618+
bash_completion_dir = $(prefix)/share/bash-completion/completions
618619
gitexecdir = libexec/git-core
619620
mergetoolsdir = $(gitexecdir)/mergetools
620621
sharedir = $(prefix)/share
@@ -2327,6 +2328,7 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
23272328
mandir_SQ = $(subst ','\'',$(mandir))
23282329
mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
23292330
infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
2331+
bash_completion_dir_SQ = $(subst ','\'',$(bash_completion_dir))
23302332
perllibdir_SQ = $(subst ','\'',$(perllibdir))
23312333
localedir_SQ = $(subst ','\'',$(localedir))
23322334
localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
@@ -3571,6 +3573,10 @@ endif
35713573
ifneq (,$X)
35723574
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
35733575
endif
3576+
ifndef NO_BASH_COMPLETION
3577+
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bash_completion_dir_SQ)' && \
3578+
$(INSTALL) -m 644 contrib/completion/git-completion.bash '$(DESTDIR_SQ)$(bash_completion_dir_SQ)/git'
3579+
endif
35743580

35753581
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
35763582
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \

contrib/completion/meson.build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,21 @@ foreach script : [
1414
)
1515
endif
1616
endforeach
17+
18+
# We have to discern between the test dependency and the installed file. Our
19+
# tests assume the completion scripts to have the same name as the in-tree
20+
# files, but the installed filenames need to match the executable's basename.
21+
if meson.version().version_compare('>=1.3.0')
22+
fs.copyfile('git-completion.bash', 'git',
23+
install: true,
24+
install_dir: get_option('datadir') / 'bash-completion/completions',
25+
)
26+
else
27+
configure_file(
28+
input: 'git-completion.bash',
29+
output: 'git',
30+
copy: true,
31+
install: true,
32+
install_dir: get_option('datadir') / 'bash-completion/completions',
33+
)
34+
endif

0 commit comments

Comments
 (0)