This commit is contained in:
aynic.os
2021-06-02 00:54:33 +02:00
parent 8661d103e5
commit 85ffdb7096
38 changed files with 509 additions and 405 deletions
+8 -5
View File
@@ -1,7 +1,7 @@
##
# GIT
# Create branch $(BRANCH) from upstream/$* branch
# target git-branch-create-upstream-%: Create git BRANCH from upstream/% branch
.PHONY: git-branch-create-upstream-%
git-branch-create-upstream-%: myos-base update-upstream
$(call exec,git fetch --prune upstream)
@@ -9,13 +9,13 @@ git-branch-create-upstream-%: myos-base update-upstream
$(call exec,[ $$(git ls-remote --heads upstream $(BRANCH) |wc -l) -eq 0 ] && git push upstream $(BRANCH) || echo Unable to create branch $(BRANCH) on remote upstream.)
$(call exec,git checkout $(BRANCH))
# Delete branch $(BRANCH)
# target git-branch-delete: Delete git BRANCH
.PHONY: git-branch-delete
git-branch-delete: myos-base update-upstream
$(call exec,git rev-parse --verify $(BRANCH) >/dev/null 2>&1 && git branch -d $(BRANCH) || echo Unable to delete branch $(BRANCH).)
$(foreach remote,upstream, $(call exec,[ $$(git ls-remote --heads $(remote) $(BRANCH) |wc -l) -eq 1 ] && git push $(remote) :$(BRANCH) || echo Unable to delete branch $(BRANCH) on remote $(remote).) &&) true
# Merge branch $(BRANCH) into upstream/$* branch
# target git-branch-merge-upstream-%: Merge git BRANCH into upstream/% branch
.PHONY: git-branch-merge-upstream-%
git-branch-merge-upstream-%: myos-base update-upstream
$(call exec,git rev-parse --verify $(BRANCH) >/dev/null 2>&1)
@@ -27,19 +27,21 @@ git-branch-merge-upstream-%: myos-base update-upstream
$(call exec,git merge --no-ff --no-edit $(BRANCH))
$(call exec,git push upstream $*)
# target git-stash: git stash
.PHONY: git-stash
git-stash: myos-base git-status
if [ ! $(STATUS) -eq 0 ]; then \
$(call exec,git stash); \
fi
# target git-status: Define STATUS with number of lines of git status
.PHONY: git-status
git-status: myos-base
$(eval DRYRUN_IGNORE := true)
$(eval STATUS := $(shell $(call exec,git status -uno --porcelain 2>/dev/null |wc -l)))
$(eval DRYRUN_IGNORE := false)
# Create $(TAG) tag to reference upstream/$* branch
# target git-tag-create-upstream-%: Create git TAG to reference upstream/% branch
.PHONY: git-tag-create-upstream-%
git-tag-create-upstream-%: myos-base update-upstream
ifneq ($(words $(TAG)),0)
@@ -53,7 +55,7 @@ ifneq ($(words $(TAG)),0)
$(call exec,git push --tags upstream $*)
endif
# Merge tag $(TAG) into upstream/$* branch
# target git-tag-merge-upstream-%: Merge git TAG into upstream/% branch
.PHONY: git-tag-merge-upstream-%
git-tag-merge-upstream-%: myos-base update-upstream
ifneq ($(words $(TAG)),0)
@@ -63,6 +65,7 @@ ifneq ($(words $(TAG)),0)
$(call exec,git push upstream $*)
endif
# target git-unstash: git stash pop
.PHONY: git-unstash
git-unstash: myos-base
$(eval STATUS ?= 0)