Skip to content

Commit

Permalink
Revert "Fixed bash-completion integration with git"
Browse files Browse the repository at this point in the history
This reverts commit 7816a57 because
it is not compatible with Windows.

Fixes #627
  • Loading branch information
admorgan committed Jul 25, 2024
1 parent 3a53c20 commit de62dc9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
29 changes: 11 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SHELL := bash
INSTALL ?= install

# Make sure we have git:
ifeq ($(shell which git),)
Expand All @@ -18,11 +17,9 @@ SHARE = share

# Install variables:
PREFIX ?= /usr/local
INSTALL_BIN ?= $(PREFIX)/bin
INSTALL_LIB ?= $(PREFIX)/share/$(NAME)
INSTALL_LIB ?= $(DESTDIR)$(shell git --exec-path)
INSTALL_EXT ?= $(INSTALL_LIB)/$(NAME).d
INSTALL_MAN1 ?= $(PREFIX)/share/man/man1
LINK_REL_DIR := $(shell realpath --relative-to=$(INSTALL_BIN) $(INSTALL_LIB))
INSTALL_MAN1 ?= $(DESTDIR)$(PREFIX)/share/man/man1

# Docker variables:
DOCKER_TAG ?= 0.0.6
Expand Down Expand Up @@ -63,22 +60,18 @@ $(DOCKER_TESTS):

# Install support:
install:
$(INSTALL) -d -m 0755 $(DESTDIR)$(INSTALL_LIB)/
$(INSTALL) -C -m 0755 $(LIB) $(DESTDIR)$(INSTALL_LIB)/
sed -i 's!^SUBREPO_EXT_DIR=.*!SUBREPO_EXT_DIR=$(INSTALL_EXT)!' $(DESTDIR)$(INSTALL_LIB)/$(NAME)
$(INSTALL) -d -m 0755 $(DESTDIR)$(INSTALL_BIN)
ln -s $(LINK_REL_DIR)/$(NAME) $(DESTDIR)$(INSTALL_BIN)/$(NAME)
$(INSTALL) -d -m 0755 $(DESTDIR)$(INSTALL_EXT)/
$(INSTALL) -C -m 0644 $(EXTS) $(DESTDIR)$(INSTALL_EXT)/
$(INSTALL) -d -m 0755 $(DESTDIR)$(INSTALL_MAN1)/
$(INSTALL) -C -m 0644 $(MAN1)/$(NAME).1 $(DESTDIR)$(INSTALL_MAN1)/
install -d -m 0755 $(INSTALL_LIB)/
install -C -m 0755 $(LIB) $(INSTALL_LIB)/
install -d -m 0755 $(INSTALL_EXT)/
install -C -m 0644 $(EXTS) $(INSTALL_EXT)/
install -d -m 0755 $(INSTALL_MAN1)/
install -C -m 0644 $(MAN1)/$(NAME).1 $(INSTALL_MAN1)/

# Uninstall support:
uninstall:
rm -f $(DESTDIR)$(INSTALL_BIN)/$(NAME)
rm -fr $(DESTDIR)$(INSTALL_EXT)
rm -fr $(DESTDIR)$(INSTALL_LIB)
rm -f $(DESTDIR)$(INSTALL_MAN1)/$(NAME).1
rm -f $(INSTALL_LIB)/$(NAME)
rm -fr $(INSTALL_EXT)
rm -f $(INSTALL_MAN1)/$(NAME).1

env:
@echo "export PATH=\"$$PWD/lib:\$$PATH\""
Expand Down
21 changes: 17 additions & 4 deletions lib/git-subrepo
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ set -e
export FILTER_BRANCH_SQUELCH_WARNING=1

# Import Bash+ helper functions:
SUBREPO_EXT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/git-subrepo.d" # replaced by `make install`
source "${SUBREPO_EXT_DIR}/bash+.bash"
SOURCE=${BASH_SOURCE[0]}
while [[ -h $SOURCE ]]; do
DIR=$( cd -P "$( dirname "$SOURCE" )" && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE
done
SOURCE_DIR=$(dirname "$SOURCE")

if [[ -z $GIT_SUBREPO_ROOT ]]; then
# If `make install` installation used:
source "${SOURCE_DIR}/git-subrepo.d/bash+.bash"
else
# If `source .rc` method used:
source "${SOURCE_DIR}/../ext/bashplus/lib/bash+.bash"
fi
bash+:import :std can version-check


Expand Down Expand Up @@ -384,7 +397,7 @@ command:config() {

# Launch the manpage viewer:
command:help() {
source "${SUBREPO_EXT_DIR}/help-functions.bash"
source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash"
local cmd=${command_arguments[0]}
if [[ $cmd ]]; then
if can "help:$cmd"; then
Expand Down Expand Up @@ -1974,7 +1987,7 @@ OK() {
usage-error() {
local msg="git-subrepo: $1" usage=
if [[ $GIT_SUBREPO_TEST_ERRORS != true ]]; then
source "${SUBREPO_EXT_DIR}/help-functions.bash"
source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash"
if can "help:$command"; then
msg=$'\n'"$msg"$'\n'"$("help:$command")"$'\n'
fi
Expand Down

0 comments on commit de62dc9

Please sign in to comment.