@@ -220,8 +220,8 @@ post-commit: $(if $(DOT_WAIT),,do-commit)
220220GITHUB_RUBY_URL = https://github.com/ruby/ruby
221221PR =
222222
223- COMMIT_GPG_SIGN = $(shell $(GIT ) -C " $( srcdir ) " config commit.gpgsign)
224- REMOTE_GITHUB_URL = $(shell $(GIT ) -C " $( srcdir ) " config remote.github.url)
223+ COMMIT_GPG_SIGN = $(shell $(GIT_IN_SRC ) config commit.gpgsign)
224+ REMOTE_GITHUB_URL = $(shell $(GIT_IN_SRC ) config remote.github.url)
225225COMMITS_NOTES = commits
226226
227227.PHONY : fetch-github
@@ -236,19 +236,19 @@ define fetch-github
236236 $(eval REMOTE_GITHUB_URL := $(REMOTE_GITHUB_URL ) )
237237 $(if $(REMOTE_GITHUB_URL ) ,,
238238 echo adding $(GITHUB_RUBY_URL ) as remote github
239- $(GIT ) -C " $( srcdir ) " remote add github $(GITHUB_RUBY_URL )
240- $(GIT ) -C " $( srcdir ) " config --add remote.github.fetch +refs/notes/$(COMMITS_NOTES ) :refs/notes/$(COMMITS_NOTES )
239+ $(GIT_IN_SRC ) remote add github $(GITHUB_RUBY_URL )
240+ $(GIT_IN_SRC ) config --add remote.github.fetch +refs/notes/$(COMMITS_NOTES ) :refs/notes/$(COMMITS_NOTES )
241241 $(eval REMOTE_GITHUB_URL := $(GITHUB_RUBY_URL ) )
242242 )
243- $(if $(shell $(GIT ) -C " $( srcdir ) " rev-parse "github/pull/$(1 ) /head" -- 2> /dev/null) ,
244- $(GIT ) -C " $( srcdir ) " branch -f "gh-$(1 ) " "github/pull/$(1 ) /head",
245- $(GIT ) -C " $( srcdir ) " fetch -f github "pull/$(1 ) /head:gh-$(1 ) "
243+ $(if $(shell $(GIT_IN_SRC ) rev-parse "github/pull/$(1 ) /head" -- 2> /dev/null) ,
244+ $(GIT_IN_SRC ) branch -f "gh-$(1 ) " "github/pull/$(1 ) /head",
245+ $(GIT_IN_SRC ) fetch -f github "pull/$(1 ) /head:gh-$(1 ) "
246246 )
247247endef
248248
249249.PHONY : checkout-github
250250checkout-github : fetch-github
251- $(GIT ) -C " $( srcdir ) " checkout " gh-$( PR) "
251+ $(GIT_IN_SRC ) checkout " gh-$( PR) "
252252
253253.PHONY : update-github
254254update-github : fetch-github
@@ -261,25 +261,25 @@ update-github: fetch-github
261261 $(eval PR_BRANCH := $(word 2,$(PULL_REQUEST_FORK_BRANCH ) ) )
262262
263263 $(eval GITHUB_UPDATE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(PR)-XXXXXX"))
264- $(GIT) -C "$(srcdir)" worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)"
264+ $(GIT_IN_SRC) worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)"
265265 $(GIT) -C "$(GITHUB_UPDATE_WORKTREE)" merge master --no-edit
266266 @$(BASERUBY) -e 'print "Are you sure to push this to PR=$(PR)? [Y/n]: "; exit(gets.chomp != "n")'
267- $(GIT) -C "$(srcdir)" remote add fork-$(PR) git@github.com:$(FORK_REPO).git
267+ $(GIT_IN_SRC) remote add fork-$(PR) git@github.com:$(FORK_REPO).git
268268 $(GIT) -C "$(GITHUB_UPDATE_WORKTREE)" push fork-$(PR) gh-$(PR):$(PR_BRANCH)
269- $(GIT) -C "$(srcdir)" remote rm fork-$(PR)
270- $(GIT) -C "$(srcdir)" worktree remove $(notdir $(GITHUB_UPDATE_WORKTREE))
271- $(GIT) -C "$(srcdir)" branch -D gh-$(PR)
269+ $(GIT_IN_SRC) remote rm fork-$(PR)
270+ $(GIT_IN_SRC) worktree remove $(notdir $(GITHUB_UPDATE_WORKTREE))
271+ $(GIT_IN_SRC) branch -D gh-$(PR)
272272
273273.PHONY : pull-github
274274pull-github : fetch-github
275275 $(call pull-github,$(PR ) )
276276
277277define pull-github
278- $(eval GITHUB_MERGE_BASE := $(shell $(GIT ) -C " $( srcdir ) " log -1 --format=format :% H) )
279- $(eval GITHUB_MERGE_BRANCH := $(shell $(GIT ) -C " $( srcdir ) " symbolic-ref --short HEAD) )
278+ $(eval GITHUB_MERGE_BASE := $(shell $(GIT_LOG_FORMAT ) :% H -1 )
279+ $(eval GITHUB_MERGE_BRANCH := $(shell $(GIT_IN_SRC ) symbolic-ref --short HEAD) )
280280 $(eval GITHUB_MERGE_WORKTREE := $(shell mktemp -d "$(srcdir ) /gh-$(1 ) -XXXXXX") )
281- $(GIT ) -C " $( srcdir ) " worktree prune
282- $(GIT ) -C " $( srcdir ) " worktree add $(notdir $(GITHUB_MERGE_WORKTREE ) ) "gh-$(1 ) "
281+ $(GIT_IN_SRC ) worktree prune
282+ $(GIT_IN_SRC ) worktree add $(notdir $(GITHUB_MERGE_WORKTREE ) ) "gh-$(1 ) "
283283 $(GIT ) -C "$(GITHUB_MERGE_WORKTREE ) " rebase $(GITHUB_MERGE_BRANCH )
284284 $(eval COMMIT_GPG_SIGN := $(COMMIT_GPG_SIGN ) )
285285 $(if $(filter true,$(COMMIT_GPG_SIGN ) ) , \
@@ -294,7 +294,7 @@ fetch-github-%:
294294
295295.PHONY: checkout-github-%
296296checkout-github-% : fetch-github-%
297- $(GIT ) -C " $( srcdir ) " checkout " gh-$* "
297+ $(GIT_IN_SRC ) checkout "gh-$* "
298298
299299.PHONY: pr-% pull-github-%
300300pr-% pull-github-% : fetch-github-%
@@ -433,7 +433,7 @@ ifneq ($(DOT_WAIT),)
433433endif
434434
435435ifeq ($(HAVE_GIT ) ,yes)
436- REVISION_LATEST := $(shell $(CHDIR ) $( srcdir ) && $( GIT ) log -1 --format= % H 2>/dev/null)
436+ REVISION_LATEST := $(shell $(GIT_LOG_FORMAT ) % H -1 2>/dev/null)
437437else
438438REVISION_LATEST := update
439439endif
@@ -495,7 +495,7 @@ endif
495495update-deps:
496496 $(eval update_deps := $(shell date +update-deps-% Y% m% d) )
497497 $(eval deps_dir := $(shell mktemp -d) /$(update_deps ) )
498- $(eval GIT_DIR := $(shell $(GIT ) -C $( srcdir ) rev-parse --absolute-git-dir) )
498+ $(eval GIT_DIR := $(shell $(GIT_IN_SRC ) rev-parse --absolute-git-dir) )
499499 $(GIT ) --git-dir=$(GIT_DIR ) worktree add $(deps_dir )
500500 cp $(tooldir ) /config.guess $(tooldir ) /config.sub $(deps_dir ) /tool
501501 [ -f config.status ] && cp config.status $(deps_dir )
@@ -543,13 +543,13 @@ matz: up
543543 $(eval NEW := $(MAJOR ) .$(MINOR ) .0)
544544 $(eval message := Development of $(NEW ) started.)
545545 $(eval files := include/ruby/version.h include/ruby/internal/abi.h)
546- $(GIT ) -C $( srcdir ) mv -f NEWS.md doc/NEWS/NEWS-$(OLD ) .md
547- $(GIT ) -C $( srcdir ) commit -m " [DOC] Flush NEWS.md"
546+ $(GIT_IN_SRC ) mv -f NEWS.md doc/NEWS/NEWS-$(OLD ) .md
547+ $(GIT_IN_SRC ) commit -m "[DOC] Flush NEWS.md"
548548 sed -i~ \
549549 -e "s/^\(# define RUBY_API_VERSION_MINOR\) .*/\1 $(MINOR)/" \
550550 -e "s/^\(#define RUBY_ABI_VERSION\) .*/\1 0/" \
551551 $(files:%=$(srcdir)/%)
552- $(GIT ) -C $( srcdir ) add $(files )
552+ $(GIT_IN_SRC ) add $(files )
553553 $(BASERUBY ) -C $(srcdir ) -p -00 \
554554 -e 'BEGIN {old, new = ARGV.shift(2); STDOUT.reopen("NEWS.md")}' \
555555 -e 'case $$.' \
@@ -559,8 +559,8 @@ matz: up
559559 -e 'next if /^[\[ *]/ =~ $$_' \
560560 -e '$$_.sub!(/\n{2,}\z/, "\n\n")' \
561561 $(OLD ) $(NEW ) doc/NEWS/NEWS-$(OLD ) .md
562- $(GIT ) -C $( srcdir ) add NEWS.md
563- $(GIT ) -C $( srcdir ) commit -m " $( message) "
562+ $(GIT_IN_SRC ) add NEWS.md
563+ $(GIT_IN_SRC ) commit -m "$(message ) "
564564
565565tags:
566566 $(MAKE ) GIT="$(GIT ) " -C "$(srcdir ) " -f defs/tags.mk
0 commit comments