Skip to content

Instantly share code, notes, and snippets.

@i80and
Last active August 7, 2024 01:26
Show Gist options
  • Select an option

  • Save i80and/834ccd5377272eceb95a3437b387706a to your computer and use it in GitHub Desktop.

Select an option

Save i80and/834ccd5377272eceb95a3437b387706a to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
DOCS_REPO=$1
DRIVER_REPO=$2
BRANCH=$3
DRIVER_BRANCH=$4
usage() {
echo "do.sh <docs-url> <driver-url> <branch>"
exit 1
}
if [ -z "$DOCS_REPO" ]; then
usage
fi
if [ -z "$DRIVER_REPO" ]; then
usage
fi
if [ -z "$BRANCH" ]; then
usage
fi
rm -rf docs driver || true
git clone -b "$BRANCH" "$DOCS_REPO" docs
git clone -b "$DRIVER_BRANCH" "$DRIVER_REPO" driver
(
cd driver
git filter-repo --path docs --path-rename docs/:source/
)
(
cd docs
git remote add driver-repo ../driver
git fetch driver-repo
git merge "remotes/driver-repo/$DRIVER_BRANCH" --allow-unrelated-histories
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment