mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
git-submod.mk: Fix wrong GIT_REPO_URL
Fix wrong GIT_REPO_URL and allow repos without a master while we're at it. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e66aa18e3f
commit
c5f5a3bb41
1 changed files with 9 additions and 7 deletions
|
|
@ -4,15 +4,17 @@
|
|||
# - include <path-to-this-makefile>
|
||||
# - run git-init-submod-remote
|
||||
|
||||
ifeq ($(USE_USER_URL),)
|
||||
ifeq ($(USE_USER_URL),true)
|
||||
JANWARE_USER_PREFIX = $(JANWARE_USER)@
|
||||
endif
|
||||
|
||||
GIT_SRV_ADMIN_SH = ssh $(JANWARE_USER_PREFIX)git.janware.com /opt/jw-build/bin/git-srv-admin.sh
|
||||
GIT_REPO_URL = ssh://$(JANWARE_USER_PREFIX)git.janware.com/srv/git/$(JANWARE_USER)/contrib/$(PROJECT_DIRNAME)
|
||||
SUBMOD_PATH = $(patsubst $(abspath $(TOPDIR))/%,%,$(abspath $(shell $(CWD))/$(SUBMOD_SRC_DIR)))
|
||||
GIT_REPO_URL = ssh://$(JANWARE_USER_PREFIX)git.janware.com/srv/git/$(JANWARE_USER)/contrib/$(SUBMOD_PKG_NAME)
|
||||
SUBMOD_PATH = $(patsubst $(abspath $(TOPDIR))/%,%,$(abspath $(CWD)/$(SUBMOD_SRC_DIR)))
|
||||
SUBMOD_SRC_DIR ?= .
|
||||
SUB_GIT = git -C $(SUBMOD_SRC_DIR)
|
||||
SUBMOD_PKG_NAME := $(shell $(SUB_GIT) remote -v | sed -n 's/^[a-zA-Z_]\+\s//; s/ *.*//; s%.*/%%; s%\.git%%; 1p')
|
||||
SUBMOD_MAIN_BRANCH := $(shell $(SUB_GIT) branch --format '%(refname:lstrip=2)')
|
||||
|
||||
all:
|
||||
install:
|
||||
|
|
@ -20,13 +22,13 @@ clean:
|
|||
distclean:
|
||||
|
||||
git-init-submod-remote:
|
||||
$(GIT_SRV_ADMIN_SH) -F contrib create-repo $(PROJECT_DIRNAME)
|
||||
$(GIT_SRV_ADMIN_SH) -F contrib create-repo $(SUBMOD_PKG_NAME)
|
||||
$(SUB_GIT) remote rename origin upstream
|
||||
$(SUB_GIT) remote set-url --push upstream no-push
|
||||
$(SUB_GIT) remote add origin $(GIT_REPO_URL)
|
||||
$(SUB_GIT) config branch.master.remote origin
|
||||
$(SUB_GIT) config branch.master.merge refs/heads/master
|
||||
$(SUB_GIT) push origin master
|
||||
$(SUB_GIT) config branch.$(SUBMOD_MAIN_BRANCH).remote origin
|
||||
$(SUB_GIT) config branch.$(SUBMOD_MAIN_BRANCH).merge refs/heads/$(SUBMOD_MAIN_BRANCH)
|
||||
$(SUB_GIT) push origin $(SUBMOD_MAIN_BRANCH)
|
||||
git -C $(TOPDIR) submodule add -f $(GIT_REPO_URL) $(SUBMOD_PATH)
|
||||
git submodule init
|
||||
git commit -m "Add git submodule $(SUBMOD_PATH)" $(SUBMOD_SRC_DIR) $(TOPDIR)/.gitmodules
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue