index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-07-19 15:36:34 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-19 15:36:34 +0200 |
commit | a381a6e5fc064a4658bc24ce06c7c1f8907efe7b (patch) | |
tree | 0768faa6bf645d6ff005e571edf2e1fee7a9b047 /bin/common-functions | |
parent | a3a1fe4b7ee8815af6568b7b42056fad14cc057b (diff) |
-rwxr-xr-x | bin/common-functions | 33 |
diff --git a/bin/common-functions b/bin/common-functions index 2d2fd52..baf5750 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -493,3 +493,36 @@ append_architectures() { local PKGBUILD="$1" sed -i '/^arch=(/s/(/(i686 /' } + +# find_newest_of_git_revisions +# find newest git revision of the ones provided at stdin +# (assuming linear history) + +find_newest_of_git_revisions() { + local revisions + local repo + revisions="$(cat)" + + repo="$( + find_repository_with_commit \ + "$( + echo "${revisions}" | \ + grep -xm1 '[0-9a-f]\{40\}' + )" + )" + + eval 'repo="${repo_paths__'"${repo}"'}"' + + echo "${revisions}" | \ + xargs -rn1 git -C "${repo}" rev-parse | \ + ( + newest='' + while read -r current; do + if [ -z "${newest}" ] || \ + git -C "${repo}" merge-base --is-ancestor "${newest}" "${current}"; then + newest="${current}" + fi + done + echo "${newest}" + ) +} |