Commit 4df3aef9 authored by Pietro Albini's avatar Pietro Albini

Merge branch 'sh' into 'master'

update-repos: simplify looping through directories

See merge request !1
parents 8d1a2276 0a6817e7
#!/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