ruby-changes:57055
From: Takashi <ko1@a...>
Date: Fri, 16 Aug 2019 01:37:44 +0900 (JST)
Subject: [ruby-changes:57055] Takashi Kokubun: 2f919a92ba (master): Improve `make update-github` to avoid configure
https://git.ruby-lang.org/ruby.git/commit/?id=2f919a92ba From 2f919a92ba45d1174aa72498585ff7025142d9e3 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 16 Aug 2019 01:34:51 +0900 Subject: Improve `make update-github` to avoid configure after doing it once. diff --git a/defs/gmake.mk b/defs/gmake.mk index 981cb77..2436d37 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -190,7 +190,7 @@ checkout-github: fetch-github https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L190 git -C "$(srcdir)" checkout "gh-$(PR)" .PHONY: update-github -update-github: checkout-github +update-github: fetch-github $(eval PULL_REQUEST_API := https://api.github.com/repos/ruby/ruby/pulls/$(PR)) $(eval PULL_REQUEST_FORK_BRANCH := $(shell \ curl -s $(if $(GITHUB_TOKEN),-H "Authorization: bearer $(GITHUB_TOKEN)") $(PULL_REQUEST_API) | \ @@ -198,10 +198,13 @@ update-github: checkout-github https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L198 )) $(eval FORK_REPO := $(shell echo $(PULL_REQUEST_FORK_BRANCH) | cut -d' ' -f1)) $(eval PR_BRANCH := $(shell echo $(PULL_REQUEST_FORK_BRANCH) | cut -d' ' -f2)) - git merge master --no-edit - git remote get-url fork-$(PR) || git remote add fork-$(PR) git@g...:$(FORK_REPO).git - git push fork-$(PR) gh-$(PR):$(PR_BRANCH) - git remote rm fork-$(PR) + + $(eval GITHUB_UPDATE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(PR)-XXXXXX")) + git -C "$(srcdir)" worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)" + git -C "$(GITHUB_UPDATE_WORKTREE)" merge master --no-edit + @$(BASERUBY) -e 'print "Are you sure to push this to PR=$(PR)? [Y/n]: "; exit(gets.chomp == "n" ? 1 : 0)' + git -C "$(GITHUB_UPDATE_WORKTREE)" remote add fork-$(PR) git@g...:$(FORK_REPO).git + git -C "$(GITHUB_UPDATE_WORKTREE)" push fork-$(PR) gh-$(PR):$(PR_BRANCH) .PHONY: pull-github pull-github: fetch-github -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/