add a tool to migrate tags from files to dirs
This commit is contained in:
parent
35b68bbca1
commit
6ddf787d9e
1 changed files with 35 additions and 0 deletions
35
tools/update-tags-encoding
Executable file
35
tools/update-tags-encoding
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Check out the `entomologist-data` branch in a temporary worktree.
|
||||
# For each issue with a `tags` file:
|
||||
# read
|
||||
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
WORKTREE_DIR=$(mktemp --directory)
|
||||
git worktree add "${WORKTREE_DIR}" entomologist-data
|
||||
pushd "${WORKTREE_DIR}" > /dev/null
|
||||
|
||||
for ISSUE_ID in $(find . -maxdepth 1 -type d -regextype posix-extended -regex '\./[0-9a-f]{32}'); do
|
||||
if ! [[ -f "${ISSUE_ID}/tags" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
pushd "${ISSUE_ID}" > /dev/null
|
||||
|
||||
echo "${ISSUE_ID} has tags:"
|
||||
TAGS=$(cat tags)
|
||||
git rm tags
|
||||
mkdir tags
|
||||
for TAG in ${TAGS}; do
|
||||
touch "tags/${TAG}"
|
||||
done
|
||||
git add tags
|
||||
#git commit -m "issue ${ISSUE_ID}: update tags to new format"
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
||||
popd > /dev/null
|
||||
git worktree remove "${WORKTREE_DIR}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue