From 6933bdd44d9d2ec40df542c30659b7cb24f47127 Mon Sep 17 00:00:00 2001 From: Ben Aultowski Date: Wed, 25 Feb 2026 21:30:04 -0500 Subject: [PATCH] Added graphics-components as subtree, for real this time. --- scripts/import-graphics-components.sh | 24 ++++++++++++++++++++++++ scripts/update-graphics-components.sh | 17 +++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 scripts/import-graphics-components.sh create mode 100644 scripts/update-graphics-components.sh diff --git a/scripts/import-graphics-components.sh b/scripts/import-graphics-components.sh new file mode 100644 index 0000000..66a08d8 --- /dev/null +++ b/scripts/import-graphics-components.sh @@ -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)" diff --git a/scripts/update-graphics-components.sh b/scripts/update-graphics-components.sh new file mode 100644 index 0000000..3348171 --- /dev/null +++ b/scripts/update-graphics-components.sh @@ -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)"