Skip to content

Commit fd1d12d

Browse files
yuvalkbutler54
andauthored
fix: Infer the git remote from the branch name (#36)
this is better than assuming it's called `origin` because in many cases people want to use forks on the same local directory Co-authored-by: Chris Butler <chris.butler@redhat.com>
1 parent 647aa5c commit fd1d12d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ EXTRA_PLAYBOOK_OPTS ?=
1717
# INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:394248,registry-proxy.engineering.redhat.com/rh-osbs/iib:394249
1818
INDEX_IMAGES ?=
1919

20-
TARGET_ORIGIN ?= origin
2120
# This is to ensure that whether we start with a git@ or https:// URL, we end up with an https:// URL
2221
# This is because we expect to use tokens for repo authentication as opposed to SSH keys
2322
TARGET_REPO=$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN) | sed -e 's/.*URL:[[:space:]]*//' -e 's%^git@%%' -e 's%^https://%%' -e 's%:%/%' -e 's%^%https://%')
2423
# git branch --show-current is also available as of git 2.22, but we will use this for compatibility
2524
TARGET_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
2625

26+
#default to the branch remote
27+
TARGET_ORIGIN ?= $(shell git config branch.$(TARGET_BRANCH).remote)
28+
2729
UUID_FILE ?= ~/.config/validated-patterns/pattern-uuid
2830
UUID_HELM_OPTS ?=
2931

0 commit comments

Comments
 (0)