ruby-changes:56584
From: Nobuyoshi <ko1@a...>
Date: Wed, 17 Jul 2019 11:57:41 +0900 (JST)
Subject: [ruby-changes:56584] Nobuyoshi Nakada: af07e07ac9 (master): Separate pull-github from merge-github [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=af07e07ac9 From af07e07ac9331ec9c2f16b2329a0471ea663dd95 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 17 Jul 2019 11:56:40 +0900 Subject: Separate pull-github from merge-github [ci skip] diff --git a/defs/gmake.mk b/defs/gmake.mk index 0824cab..4a16552 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -185,36 +185,54 @@ endef https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L185 checkout-github: fetch-github git -C "$(srcdir)" checkout "gh-$(PR)" +.PHONY: pull-github +pull-github: fetch-github + $(call pull-github,$(PR)) + .PHONY: merge-github -merge-github: fetch-github +merge-github: pull-github $(call merge-github,$(PR)) -define merge-github +define pull-github $(eval GITHUB_MERGE_BASE := $(shell git -C "$(srcdir)" log -1 --format=format:%H)) $(eval GITHUB_MERGE_BRANCH := $(shell git -C "$(srcdir)" symbolic-ref --short HEAD)) $(eval GITHUB_MERGE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(1)-XXXXXX")) git -C "$(srcdir)" worktree add $(notdir $(GITHUB_MERGE_WORKTREE)) "gh-$(1)" git -C "$(GITHUB_MERGE_WORKTREE)" rebase $(GITHUB_MERGE_BRANCH) - git -C "$(srcdir)" worktree remove $(notdir $(GITHUB_MERGE_WORKTREE)) - git -C "$(srcdir)" merge --ff-only "gh-$(1)" - git -C "$(srcdir)" branch -D "gh-$(1)" - git -C "$(srcdir)" filter-branch -f \ + git -C "$(GITHUB_MERGE_WORKTREE)" filter-branch -f \ --msg-filter 'cat && echo && echo "Closes: $(GITHUB_RUBY_URL)/pull/$(1)"' \ -- "$(GITHUB_MERGE_BASE)..@" $(eval COMMIT_GPG_SIGN := $(COMMIT_GPG_SIGN)) $(if $(filter true,$(COMMIT_GPG_SIGN)), \ - git -C "$(srcdir)" rebase --exec "git commit --amend --no-edit -S" "$(GITHUB_MERGE_BASE)"; \ + git -C "$(GITHUB_MERGE_WORKTREE)" rebase --exec "git commit --amend --no-edit -S" "$(GITHUB_MERGE_BASE)"; \ ) endef +define merge-github + git -C "$(srcdir)" worktree remove $(notdir $(GITHUB_MERGE_WORKTREE)) + git -C "$(srcdir)" merge --ff-only "gh-$(1)" + git -C "$(srcdir)" branch -D "gh-$(1)" +endef + +.PHONY: fetch-github-% fetch-github-%: $(call fetch-github,$*) -pr-% merge-github-%: fetch-github-% +.PHONY: checkout-github-% +checkout-github-%: fetch-github-% + git -C "$(srcdir)" checkout "gh-$(1)" + +.PHONY: pr-% pull-github-% +pr-% pull-github-%: fetch-github-% + $(call pull-github,$*) + +.PHONY: merge-github-% +merge-github-%: pull-github-% $(call merge-github,$*) HELP_EXTRA_TASKS = \ " checkout-github: checkout GitHub Pull Request [PR=1234]" \ + " pull-github: rebase GitHub Pull Request to new worktree [PR=1234]" \ " merge-github: merge GitHub Pull Request to current HEAD [PR=1234]" \ "" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/