Move non-Nix bash scripts
This commit is contained in:
parent
7c9ffc116e
commit
f2eea2d397
21 changed files with 11 additions and 10 deletions
25
modules/home-manager/cli/bin/scripts/update-all-git-repos
Executable file
25
modules/home-manager/cli/bin/scripts/update-all-git-repos
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Update all top-level Git repository clones within my Code directories to their
|
||||
# latest version.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
dirs=$(find "$XDG_REPOS_DIR" -mindepth 1 -maxdepth 2 -type d -name .git -not -path '*/*.old/*')
|
||||
|
||||
for dir in $dirs; do
|
||||
repo_path="${dir%/.git}"
|
||||
|
||||
cd "${repo_path}"
|
||||
|
||||
# If the repo is a bare clone, the commands need to be run within the
|
||||
# worktree directory.
|
||||
[[ -f .bare/worktrees/main/gitdir && -d main && -f main/.git ]] && cd main
|
||||
|
||||
echo "Updating $(pwd)"
|
||||
|
||||
# Update the repository.
|
||||
git fetch --all --jobs=4 --progress --prune || true
|
||||
git pull --rebase || true
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue