Added fallback remote for `grunt master`

no issue

- our docs do not tell the user to set up an `upstream` remote for Casper, so
  running `grunt master` will fail as it expects `upstream` to exist
- this commit adds detection for if `upstream` exists, and falls back to
  `origin` if not
This commit is contained in:
Daniel Lockyer 2021-01-14 12:28:55 +00:00
parent 6d2dfff5b5
commit 2bdb9c5d0a
No known key found for this signature in database
GPG Key ID: FFBC6FA2A6F6ABC1
1 changed files with 10 additions and 5 deletions

View File

@ -219,7 +219,7 @@ const configureGrunt = function (grunt) {
const upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
grunt.log.writeln('Pulling down the latest master from ' + upstream);
return `
git submodule sync
git submodule sync && \
git submodule update
if ! git diff --exit-code --quiet --ignore-submodules=untracked; then
@ -227,11 +227,16 @@ const configureGrunt = function (grunt) {
exit 1
fi
git checkout master
git pull ${upstream} master
yarn
REMOTE=$(git remote | grep "${upstream}" > /dev/null && echo "${upstream}" || echo "origin")
git checkout master && \
git pull $REMOTE master && \
yarn && \
git submodule foreach "
git checkout master && git pull ${upstream} master
git checkout master
REMOTE=$(git remote | grep "${upstream}" > /dev/null && echo "${upstream}" || echo "origin")
git pull $REMOTE master
"
`;
}