Skip to content

Commit

Permalink
Alpine Git improvements (#97)
Browse files Browse the repository at this point in the history
Closes #91 
Closes #98 
Closes #99 

Signed-off-by: Mike Detwiler <mike@detwiler.io>
  • Loading branch information
detwiler authored Jan 5, 2021
1 parent ad0fbe0 commit bf986be
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 33 deletions.
2 changes: 2 additions & 0 deletions build-aux/install-reqs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ aws-cli
clang-extra-tools
ctags
g++
git-diff-highlight
less
python3-dev
vim
'
Expand Down
27 changes: 20 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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 ##

Expand Down Expand Up @@ -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],
Expand Down
1 change: 1 addition & 0 deletions data/bash/common/bashrc.d/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
aws-functions.sh
bash-completion.sh
ctags-alias.sh
git-prompt.sh
gpg2.sh
grep.sh
ls.sh
Expand Down
42 changes: 18 additions & 24 deletions data/bash/common/bashrc.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions data/bash/common/profile.d/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ conan.sh
editor.sh
go.sh
gnulib.sh
gvim.sh
info.sh
vim.sh
9 changes: 8 additions & 1 deletion data/bash/common/profile.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/bash/common/profile.d/conan.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
5 changes: 5 additions & 0 deletions data/bash/common/profile.d/git.sh
Original file line number Diff line number Diff line change
@@ -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'
1 change: 1 addition & 0 deletions data/bash/common/profile.d/gvim.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export GVIMINIT='let $MYGVIMRC="@vimdir@/gvimrc" | source $MYGVIMRC'
1 change: 1 addition & 0 deletions data/git/.gitconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
[pull]
ff = only
@GIT_CRED_HELPER_FILE@
@GIT_PAGER_FILE@
1 change: 1 addition & 0 deletions data/git/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# generated data files
.gitconfig
gitconfig-signing-key
pager-diff-highlight
3 changes: 3 additions & 0 deletions data/git/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ home_DATA = $(conf_data)

DISTCLEANFILES = $(conf_data) \
$(gitconfig_signing_key)

EXTRA_DIST = cred-helper-manager \
cred-helper-pass
4 changes: 4 additions & 0 deletions data/git/pager-diff-highlight.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pager]
log = @DIFF_HIGHLIGHT@ | less -R
show = @DIFF_HIGHLIGHT@ | less -R
diff = @DIFF_HIGHLIGHT@ | less -R

0 comments on commit bf986be

Please sign in to comment.