diff --git a/build-aux/install-reqs b/build-aux/install-reqs index 56f2907..70ef0f3 100755 --- a/build-aux/install-reqs +++ b/build-aux/install-reqs @@ -18,6 +18,8 @@ aws-cli clang-extra-tools ctags g++ +git-diff-highlight +less python3-dev vim ' diff --git a/configure.ac b/configure.ac index c72d7b9..b8cd8d1 100644 --- a/configure.ac +++ b/configure.ac @@ -131,9 +131,6 @@ QH_VAR_ENSURE([CONAN_CLANG_VERSIONS], QH_VAR_ENSURE([CONAN_GCC_VERSIONS], [colon-separated list of GCC major versions for conan-package-tools], [9]) -QH_VAR_ENSURE([CONAN_PIP_COMMAND], - [Name of Python3 version of the pip command], - ["'$PYTHON -m pip'"]) QH_VAR_ENSURE([CONAN_USERNAME], [User name required by conan-package-tools], [$USER]) @@ -214,9 +211,25 @@ AM_COND_IF([HAVE_GIT_CRED_PASS], [GIT_CRED_HELPER_FILE=/dev/null])]) AC_SUBST_FILE([GIT_CRED_HELPER_FILE]) -QH_VAR_ENSURE([GIT_PROMPT_PATH], - [path to git-prompt.sh], - [/usr/share/git-core/contrib/completion/git-prompt.sh]) +AC_ARG_VAR([DIFF_HIGHLIGHT], [path to git diff-highlight]) +AC_PATH_PROG([DIFF_HIGHLIGHT], [diff-highlight], [no], + [$PATH$PATH_SEPARATOR/usr/share/git-core/contrib$PATH_SEPARATOR/usr/share/doc/git/contrib/diff-highlight]) +AM_CONDITIONAL([HAVE_DIFF_HIGHLIGHT], [test "x$DIFF_HIGHLIGHT" != xno]) +AM_COND_IF([HAVE_DIFF_HIGHLIGHT], + [GIT_PAGER_FILE=data/git/pager-diff-highlight + AC_CONFIG_FILES([data/git/pager-diff-highlight])], + [GIT_PAGER_FILE=/dev/null]) +AC_SUBST_FILE([GIT_PAGER_FILE]) + +AC_CHECK_FILE([/etc/bash_completion.d/git-prompt]) +AM_CONDITIONAL([HAVE_GIT_PROMPT], + [test "x$ac_cv_file__etc_bash_completion_d_git_prompt" = xyes]) +AC_ARG_VAR([GIT_PROMPT_PATH], [path to git-prompt.sh]) +AS_IF([test "x$GIT_PROMPT_PATH" = x], + [AC_CHECK_FILE([/usr/share/git-core/contrib/completion/git-prompt.sh], + [GIT_PROMPT_PATH=/usr/share/git-core/contrib/completion/git-prompt.sh])]) +AM_CONDITIONAL([LOCAL_GIT_PROMPT], + [test "x$GIT_PROMPT_PATH" != x]) ## gnulib ## @@ -293,7 +306,7 @@ QH_VAR_ENSURE([VIM_CMAKE_BUILD_DIR], [.ycm-build]) QH_VAR_ENSURE([VIM_YCM_OWNER], - [Github owner for YouCompleteMe], + [GitHub owner for YouCompleteMe], [ycm-core]) QH_VAR_ENSURE([VIM_YCM_REF], diff --git a/data/bash/common/bashrc.d/.gitignore b/data/bash/common/bashrc.d/.gitignore index b564ed3..676ede2 100644 --- a/data/bash/common/bashrc.d/.gitignore +++ b/data/bash/common/bashrc.d/.gitignore @@ -4,6 +4,7 @@ aws-functions.sh bash-completion.sh ctags-alias.sh +git-prompt.sh gpg2.sh grep.sh ls.sh diff --git a/data/bash/common/bashrc.d/Makefile.am b/data/bash/common/bashrc.d/Makefile.am index ed15efc..ba5bacc 100644 --- a/data/bash/common/bashrc.d/Makefile.am +++ b/data/bash/common/bashrc.d/Makefile.am @@ -11,6 +11,7 @@ ctags_alias = ctags-alias.sh files = files.sh functions = functions.sh git_prompt = git-prompt.sh +git_prompt_url = https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh gpg2 = gpg2.sh grep = grep.sh ls = ls.sh @@ -69,38 +70,31 @@ bashrc_DATA = $(conf_data) DISTCLEANFILES = $(conf_data) # data/scripts generated by make (require explicit distribution of source file) -make_data = +# date generated from input templates +make_template_data = + +make_data = $(make_template_data) + +if !HAVE_GIT_PROMPT +make_data += $(git_prompt) +if LOCAL_GIT_PROMPT +$(git_prompt): $(GIT_PROMPT_PATH) + $(AM_V_GEN)cat $< > $@-t && mv $@-t $@ +else !LOCAL_GIT_PROMPT +$(git_prompt): + $(AM_V_GEN)$(CURL) --silent --fail --location $(git_prompt_url) > $@-t && mv $@-t $@ +endif !LOCAL_GIT_PROMPT +endif !HAVE_GIT_PROMPT bashrc_DATA += $(make_data) $(make_data): Makefile -# variables to support building our output -make_output = $(make_data) - -make_sources = $(addsuffix .in,$(make_output)) +make_sources = $(addsuffix .in,$(make_template_data)) # explicit source file distribution EXTRA_DIST = $(make_sources) \ ls.aliases \ ls-color.aliases -CLEANFILES = $(make_output) - -mk-bashrcdir: - $(AM_V_GEN)test -e $(DESTDIR)$(bashrcdir) || \ - mkdir -p $(DESTDIR)$(bashrcdir) - -$(git_prompt): mk-bashrcdir - $(AM_V_GEN)test -e $(GIT_PROMPT_PATH) && \ - (cd $(DESTDIR)$(bashrcdir) && \ - (test -h $@ || $(LN_S) $(GIT_PROMPT_PATH) $@)) || true - -if !HOST_OS_MINGW -install-data-hook: $(git_prompt) -uninstall_files = $(git_prompt) -endif - -uninstall-hook: - $(AM_V_GEN)cd $(DESTDIR)$(bashrcdir) && \ - rm -f $(uninstall_files) +CLEANFILES = $(make_data) diff --git a/data/bash/common/profile.d/.gitignore b/data/bash/common/profile.d/.gitignore index e2c56b2..35e7a95 100644 --- a/data/bash/common/profile.d/.gitignore +++ b/data/bash/common/profile.d/.gitignore @@ -5,5 +5,6 @@ conan.sh editor.sh go.sh gnulib.sh +gvim.sh info.sh vim.sh diff --git a/data/bash/common/profile.d/Makefile.am b/data/bash/common/profile.d/Makefile.am index 193bcfb..48871e3 100644 --- a/data/bash/common/profile.d/Makefile.am +++ b/data/bash/common/profile.d/Makefile.am @@ -7,16 +7,19 @@ bash = bash.sh bash_completion = bash-completion.sh conan = conan.sh editor = editor.sh -info = info.sh +git = git.sh gnulib = gnulib.sh go = go.sh gpg = gpg.sh +gvim = gvim.sh +info = info.sh macosx = macosx.sh vim = vim.sh # static data/scripts (not generated; require explicit distribution) static_data = $(bash_completion) \ $(bash) \ + $(git) \ $(gpg) if HOST_OS_DARWIN @@ -42,6 +45,10 @@ make_data = $(go) \ $(info) \ $(vim) +if HAVE_GVIM +make_data += $(gvim) +endif + profile_DATA += $(make_data) # variables to support building our output diff --git a/data/bash/common/profile.d/conan.sh.in b/data/bash/common/profile.d/conan.sh.in index 09d3f87..2d54683 100644 --- a/data/bash/common/profile.d/conan.sh.in +++ b/data/bash/common/profile.d/conan.sh.in @@ -2,5 +2,5 @@ export CONAN_CLANG_VERSIONS=@CONAN_CLANG_VERSIONS@ export CONAN_GCC_VERSIONS=@CONAN_GCC_VERSIONS@ -export CONAN_PIP_COMMAND=@CONAN_PIP_COMMAND@ +export CONAN_PIP_COMMAND='@PYTHON@ -m pip' export CONAN_USERNAME=@CONAN_USERNAME@ diff --git a/data/bash/common/profile.d/git.sh b/data/bash/common/profile.d/git.sh new file mode 100644 index 0000000..5a1f084 --- /dev/null +++ b/data/bash/common/profile.d/git.sh @@ -0,0 +1,5 @@ +export GIT_PS1_SHOWDIRTYSTATE=true +export GIT_PS1_SHOWSTASHSTATE=true +export GIT_PS1_SHOWUNTRACKEDFILES=true +export GIT_PS1_SHOWUPSTREAM='auto verbose name' +export GIT_PS1_DESCRIBE_STYLE='describe' diff --git a/data/bash/common/profile.d/gvim.sh.in b/data/bash/common/profile.d/gvim.sh.in new file mode 100644 index 0000000..f3e8eec --- /dev/null +++ b/data/bash/common/profile.d/gvim.sh.in @@ -0,0 +1 @@ +export GVIMINIT='let $MYGVIMRC="@vimdir@/gvimrc" | source $MYGVIMRC' diff --git a/data/git/.gitconfig.in b/data/git/.gitconfig.in index 309aa8b..a72f305 100644 --- a/data/git/.gitconfig.in +++ b/data/git/.gitconfig.in @@ -22,3 +22,4 @@ [pull] ff = only @GIT_CRED_HELPER_FILE@ +@GIT_PAGER_FILE@ diff --git a/data/git/.gitignore b/data/git/.gitignore index 8ec3cb8..b2ecaaa 100644 --- a/data/git/.gitignore +++ b/data/git/.gitignore @@ -3,3 +3,4 @@ # generated data files .gitconfig gitconfig-signing-key +pager-diff-highlight diff --git a/data/git/Makefile.am b/data/git/Makefile.am index acdb70c..77c0312 100644 --- a/data/git/Makefile.am +++ b/data/git/Makefile.am @@ -19,3 +19,6 @@ home_DATA = $(conf_data) DISTCLEANFILES = $(conf_data) \ $(gitconfig_signing_key) + +EXTRA_DIST = cred-helper-manager \ + cred-helper-pass diff --git a/data/git/pager-diff-highlight.in b/data/git/pager-diff-highlight.in new file mode 100644 index 0000000..dcae7ed --- /dev/null +++ b/data/git/pager-diff-highlight.in @@ -0,0 +1,4 @@ +[pager] + log = @DIFF_HIGHLIGHT@ | less -R + show = @DIFF_HIGHLIGHT@ | less -R + diff = @DIFF_HIGHLIGHT@ | less -R