Commit 0a6817e7 authored by Mattia Rizzolo's avatar Mattia Rizzolo

update-repos: simplify looping through directories

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mapreri@ubuntu.com>
parent 8d1a2276
#!/bin/bash #!/bin/bash
# Copyright (c) 2018 Pietro Albini <pietroalbini@ubuntu-it.org> # Copyright (c) 2018 Pietro Albini <pietroalbini@ubuntu-it.org>
# 2018 Mattia Rizzolo <mapreri@ubuntu.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
...@@ -20,19 +21,17 @@ ...@@ -20,19 +21,17 @@
# SOFTWARE. # SOFTWARE.
set -euo pipefail set -euo pipefail
IFS=$'\n\t'
REPOS_DIR="repos" REPOS_DIR="repos"
repos="$(ls "${REPOS_DIR}")" for repo in "$REPOS_DIR"/*; do
for repo in $repos; do
# Update the repo # Update the repo
git -C "${REPOS_DIR}/${repo}" fetch --all git -C "${repo}" fetch --all
git -C "${REPOS_DIR}/${repo}" reset --hard origin/master git -C "${repo}" reset --hard origin/master
# Commit the changes # Commit the changes
git add "${REPOS_DIR}/${repo}" git add "${repo}"
if ! git diff --staged --exit-code --quiet; then if ! git diff --staged --exit-code --quiet; then
git commit -m "${REPOS_DIR}/${repo}: use latest commit" git commit -m "${repo}: use latest commit"
fi fi
done done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment