Added graphics-components as subtree, for real this time.
This commit is contained in:
parent
57e464ac0d
commit
6933bdd44d
2 changed files with 41 additions and 0 deletions
24
scripts/import-graphics-components.sh
Normal file
24
scripts/import-graphics-components.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Usage: ./import-graphics-components.sh [branch]
|
||||
# Default branch is 'main' if not specified.
|
||||
|
||||
set -e
|
||||
|
||||
REPO_URL="https://github.com/reuters-graphics/graphics-components.git"
|
||||
REMOTE_NAME="upstreamRepo"
|
||||
SUBTREE_PREFIX="graphics-components-src"
|
||||
BRANCH="${1:-main}"
|
||||
|
||||
# Remove submodule if present
|
||||
git submodule deinit -f $SUBTREE_PREFIX 2>/dev/null || true
|
||||
git rm -f $SUBTREE_PREFIX 2>/dev/null || true
|
||||
rm -f .gitmodules
|
||||
|
||||
# Add upstream remote if not present
|
||||
git remote | grep -q "^$REMOTE_NAME$" || git remote add $REMOTE_NAME $REPO_URL
|
||||
git fetch $REMOTE_NAME
|
||||
|
||||
# Add subtree
|
||||
git subtree add --prefix=$SUBTREE_PREFIX $REMOTE_NAME $BRANCH --squash
|
||||
|
||||
echo "graphics-components-src imported as a subtree from $REPO_URL ($BRANCH)"
|
||||
17
scripts/update-graphics-components.sh
Normal file
17
scripts/update-graphics-components.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
# Usage: ./update-graphics-components.sh [branch]
|
||||
# Default branch is 'main' if not specified.
|
||||
# Add upstream remote and fetch
|
||||
set -e
|
||||
|
||||
REPO_URL="https://github.com/reuters-graphics/graphics-components.git"
|
||||
REMOTE_NAME="upstreamRepo"
|
||||
SUBTREE_PREFIX="graphics-components-src"
|
||||
BRANCH="${1:-main}"
|
||||
|
||||
git remote | grep -q "^$REMOTE_NAME$" || git remote add $REMOTE_NAME $REPO_URL
|
||||
git fetch $REMOTE_NAME
|
||||
|
||||
git subtree pull --prefix=$SUBTREE_PREFIX $REMOTE_NAME $BRANCH --squash
|
||||
|
||||
echo "graphics-components-src updated from $REPO_URL ($BRANCH)"
|
||||
Loading…
Reference in a new issue