diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-11-27 20:46:19 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-11-27 20:46:19 -0500 |
| commit | 09e3e8fde2f251f54803f129b9ffb68930e455ae (patch) | |
| tree | ff6f0b53ccfff43313469f10b2d4b72c771723f0 /executables/bin/migrate-to-sourcehut | |
| parent | Ignore other gpg files (diff) | |
| download | dotfiles-09e3e8fde2f251f54803f129b9ffb68930e455ae.zip | |
update openbsd install
Diffstat (limited to 'executables/bin/migrate-to-sourcehut')
| -rwxr-xr-x | executables/bin/migrate-to-sourcehut | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/executables/bin/migrate-to-sourcehut b/executables/bin/migrate-to-sourcehut deleted file mode 100755 index d7e471a..0000000 --- a/executables/bin/migrate-to-sourcehut +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -set -euo pipefail -set -x - -REPOS_DIR="$HOME/src/" -SOURCEHUT_USER="eugenetriguba" - -main() { - parse_args "$@" - - cd "$REPOS_DIR" - for repo in */; do - if [ -d "$repo/.git" ]; then - echo "Processing $repo..." - cd "$repo" - - if ! git remote | grep -q "^origin$"; then - echo "No origin remote found for $repo, skipping..." - cd .. - continue - fi - - if ! git remote get-url origin | grep -q "git.sr.ht"; then - echo "Migrating $repo to SourceHut..." - - local repo_name - repo_name=$(git remote get-url origin | cut -d '/' -f 2 | cut -d '.' -f 1) - git remote remove origin - git remote add origin "git@git.sr.ht:~${SOURCEHUT_USER}/${repo_name}" - - local current_branch - current_branch=$(git branch --show-current) - if [ "$current_branch" = "master" ]; then - echo "Renaming master branch to main..." - git branch -m master main - fi - - git push --push-option visiblity="private" -u origin main - git push origin main --tags - fi - - cd .. - fi - done -} - -parse_args() { - while [[ $# -gt 0 ]]; do - case "$1" in - --repos-dir) - REPOS_DIR="$2" - shift 2 - ;; - --sourcehut-user) - SOURCEHUT_USER="$2" - shift 2 - ;; - *) - echo "Usage: $0 [--repos-dir <path>] [--sourcehut-user <username>]" - exit 1 - ;; - esac - - if [[ -z "$REPOS_DIR" || ! -d "$REPOS_DIR" ]]; then - echo "Invalid or empty REPOS_DIR: $REPOS_DIR" - exit 1 - fi - - if [[ -z "$SOURCEHUT_USER" ]]; then - echo "SOURCEHUT_USER must be specified." - exit 1 - fi - done -} - -main "$@" |