summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-04-12 13:22:09 +0200
committerErich Eckner <git@eckner.net>2019-04-12 13:22:09 +0200
commit9f902ea9738f0049b94efbced75a560dc145ac1c (patch)
tree6bdd682c8055d7a1d8e26a5a006d5c80ca3ed475
parentceab9cd198f4b9c72df62b05db49c1ad9b98dea2 (diff)
downloadbuilder-9f902ea9738f0049b94efbced75a560dc145ac1c.tar.xz
bin/get-package-updates: check, that we do not go back in time
-rwxr-xr-xbin/get-package-updates11
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 1248fec..708b5ff 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -242,9 +242,16 @@ for repo in ${repo_names}; do
git -C "${repo_path}" rev-parse HEAD
)'"
else
- eval "new_repo_revisions__${repo}='$(
+ new_rev=$(
git -C "${repo_path}" rev-list -n1 --until "${date_time}" HEAD
- )'"
+ )
+ eval 'old_rev="${old_repo_revisions__'"${repo}"'}"'
+ # do not go backwards in time
+ # shellcheck disable=SC2154
+ if ! git -C "${repo_path}" merge-base --is-ancestor "${old_rev}" "${new_rev}"; then
+ new_rev="${old_rev}"
+ fi
+ eval "new_repo_revisions__${repo}='${new_rev}'"
fi
else
eval 'new_repo_revisions__'"${repo}"'="${old_repo_revisions__'"${repo}"'}"'