Skip to content

Commit 4f32f41

Browse files
committed
Improve remote resolution for the publish branch
1 parent 125a39c commit 4f32f41

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ pseudoxml:
191191
GITREPOPATH = $(CURDIR)/.git
192192
SOURCEBRANCH = $(shell git symbolic-ref --short HEAD)
193193
PUBLISHBRANCH = master
194+
PUBFIRSTREMOTE = $(shell git branch -r --list "*/$(PUBLISHBRANCH)" | head -1)
194195
GITREMOTE = $(shell git config --get branch.$(PUBLISHBRANCH).remote)
195196
GITREMOTEURL = $(shell git config --get remote.$(GITREMOTE).url)
196197
GITLASTCOMMIT = $(shell git rev-parse --short HEAD)
197198

198199
.create-publish-branch:
199-
git rev-parse --verify --quiet $(PUBLISHBRANCH) > /dev/null || \
200-
git branch --track $(PUBLISHBRANCH) origin/$(PUBLISHBRANCH)
200+
@git rev-parse --verify --quiet $(PUBLISHBRANCH) >/dev/null || \
201+
echo $(PUBFIRSTREMOTE) | grep -q . || \
202+
( echo "No remote found for branch $(PUBLISHBRANCH)" >&2; exit 1 )
203+
git rev-parse --verify --quiet $(PUBLISHBRANCH) >/dev/null || \
204+
git branch --track $(PUBLISHBRANCH) $(PUBFIRSTREMOTE)
201205

202206
publish-prepare: .create-publish-branch
203207
@test -d $(BUILDDIR)/html || \

0 commit comments

Comments
 (0)