diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-04-19 12:22:29 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-04-21 07:10:53 +0000 |
commit | a25525d38c0279eca1c22f4548d5857120a85ce6 (patch) | |
tree | 8ea41c63f5aa8087ff7fb6ca88dc86e6cb0d2fa5 /deps | |
parent | 36ef7fc04615f6b6ef5243210f52be7c3133484d (diff) |
deps/Makefile: fix checkout logic for branches
Checkout origin/$branch instead of $branch. Otherwise git will just use
the local version of branch and stay at the same commit.
Note that Ia846863eff1734eca469257b9a8d5e653a45e835 changes the lines
which still have "master" to the commit. Fixing this is still useful
however, if a branch name is used in local testing.
Change-Id: If6bd440598d375a9947cb3a4fd88ae5809756e0e
Diffstat (limited to 'deps')
-rw-r--r-- | deps/Makefile | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/deps/Makefile b/deps/Makefile index 64e293b6..8dc2a829 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -152,7 +152,15 @@ ifneq ($$($(1)_ORIGIN),$(2)/$(1)) cd $(1) && git remote set-url origin $(2)/$(1) && git fetch endif ifneq ($$($(1)_HEAD),$($(1)_commit)) - cd $(1) && git fetch && git checkout -q -f "$($(1)_commit)" + cd $(1) && \ + git fetch && \ + if git rev-parse "origin/$($(1)_commit)" 2>/dev/null; then \ + set -x && \ + git checkout -q -f "origin/$($(1)_commit)"; \ + else \ + set -x && \ + git checkout -q -f "$($(1)_commit)"; \ + fi endif endif |