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
# 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
# of this software and associated documentation files (the "Software"), to deal
......@@ -20,19 +21,17 @@
# SOFTWARE.
set -euo pipefail
IFS=$'\n\t'
REPOS_DIR="repos"
repos="$(ls "${REPOS_DIR}")"
for repo in $repos; do
for repo in "$REPOS_DIR"/*; do
# Update the repo
git -C "${REPOS_DIR}/${repo}" fetch --all
git -C "${REPOS_DIR}/${repo}" reset --hard origin/master
git -C "${repo}" fetch --all
git -C "${repo}" reset --hard origin/master
# Commit the changes
git add "${REPOS_DIR}/${repo}"
git add "${repo}"
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
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