2024-05-12 04:07:08 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Ensure three arguments are provided
|
|
|
|
if [ "$#" -ne 3 ]; then
|
|
|
|
echo "Usage: $0 <language> <repo-name> <project-name>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
language=$1
|
2024-05-28 03:37:54 +02:00
|
|
|
repo="https://github.com/prescientmoon/$2"
|
2024-05-12 04:07:08 +02:00
|
|
|
name=$3
|
|
|
|
|
|
|
|
# Ensure project with that name doesn't exist
|
|
|
|
if [ -d "$language/$name" ]; then
|
|
|
|
echo "Error: Project `$language/$name` already exists"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
git fetch $repo
|
|
|
|
josh-filter ":prefix=$language/$name:unsign" FETCH_HEAD && git checkout FILTERED_HEAD
|
|
|
|
FILTER_BRANCH_SQUELCH_WARNING=1 \
|
|
|
|
git filter-branch --msg-filter "awk \"{print \\\"$language($name): \\\" \\\$0}\"" -f && \
|
|
|
|
git rebase --root --committer-date-is-author-date --signoff
|
|
|
|
|
|
|
|
hash=$(git hash)
|
|
|
|
git switch master
|
|
|
|
git merge --allow-unrelated $hash -m "Add `$language/$name`"
|