From de62dc9e80f80fc79296be013cbecd26fc295e87 Mon Sep 17 00:00:00 2001 From: Austin Morgan Date: Thu, 25 Jul 2024 11:22:03 -0500 Subject: [PATCH 1/2] Revert "Fixed bash-completion integration with git" This reverts commit 7816a571fe46a4f53ba7c767735d4e34a9bd135d because it is not compatible with Windows. Fixes #627 --- Makefile | 29 +++++++++++------------------ lib/git-subrepo | 21 +++++++++++++++++---- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 8dd567f4..4b028a5f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ SHELL := bash -INSTALL ?= install # Make sure we have git: ifeq ($(shell which git),) @@ -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 @@ -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\"" diff --git a/lib/git-subrepo b/lib/git-subrepo index 2e9eda66..7446bf5b 100755 --- a/lib/git-subrepo +++ b/lib/git-subrepo @@ -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 @@ -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 @@ -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 From ec1d487312d6f20473b7eac94ef87d8bde422f8b Mon Sep 17 00:00:00 2001 From: Austin Morgan Date: Thu, 25 Jul 2024 11:26:49 -0500 Subject: [PATCH 2/2] Release 0.4.9 - Revert Fix bash-completion due to not being compatible with Windows --- Changes | 4 ++++ Meta | 2 +- lib/git-subrepo | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 02d09a9c..f0b981c9 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +version: 0.4.9 +date: Mon 25 Jul 2024 11:23:34 AM CST +- Revert Fix bash-completion due to not being compatible with Windows +--- version: 0.4.8 date: Mon 22 Jul 2024 07:40:00 AM CST - Remove all subrepo refs with clean --force diff --git a/Meta b/Meta index 6b173775..17e8e93f 100644 --- a/Meta +++ b/Meta @@ -1,7 +1,7 @@ =meta: 0.0.2 name: git-subrepo -version: 0.4.8 +version: 0.4.9 abstract: Git Submodule Alternative homepage: https://github.com/ingydotnet/git-subrepo#readme license: MIT diff --git a/lib/git-subrepo b/lib/git-subrepo index 7446bf5b..8c931b77 100755 --- a/lib/git-subrepo +++ b/lib/git-subrepo @@ -30,7 +30,7 @@ fi bash+:import :std can version-check -VERSION=0.4.8 +VERSION=0.4.9 REQUIRED_BASH_VERSION=4.0 REQUIRED_GIT_VERSION=2.7.0 GIT_TMP=$(git rev-parse --git-common-dir 2> /dev/null || echo .git)/tmp