diff options
author | Erich Eckner <git@eckner.net> | 2018-03-23 09:48:51 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-23 09:48:51 +0100 |
commit | b798f420fda3be00914a8ac7a5817b651a9858f4 (patch) | |
tree | e0e4b0fa0e7c8aa67c5ff9e953376c88839a1767 /bin/sanity-check | |
parent | 6f7e155ea0dd7f0e5894ec133be313bbdb4589ba (diff) | |
download | builder-b798f420fda3be00914a8ac7a5817b651a9858f4.tar.xz |
bin/sanity-check: check git heads in database, not in files
Diffstat (limited to 'bin/sanity-check')
-rwxr-xr-x | bin/sanity-check | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/sanity-check b/bin/sanity-check index e6b4184..7d1b2f0 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -119,16 +119,28 @@ while [ $# -gt 0 ]; do for repo in ${repo_names}; do eval 'repo_path="${repo_paths__'"${repo}"'}"' repo_revision=$( - cat "${work_dir}/${repo}.revision" + # shellcheck disable=SC2016 + { + printf 'SELECT `git_repositories`.`head` FROM `git_repositories`' + printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \ + "$(printf '%s' "${repo}" | base64 -w0)" + } | \ + mysql_run_query ) - if ! git -C "${repo_path}" archive "${repo_revision}" -- | \ - tar -t > /dev/null; then + if ! obj_type=$(git -C "${repo_path}" cat-file -t "${repo_revision}" 2>/dev/null); then if [ ${silence} -le 1 ]; then - printf '\nThe repository %s (%s) cannot archive the current revision %s.\n' \ + printf '\nThe repository %s (%s) does not know the current revision %s.\n' \ "${repo}" "${repo_path}" "${repo_revision}" >> \ "${tmp_dir}/messages" fi i_am_insane + elif [ "${obj_type}" != 'commit' ]; then + if [ ${silence} -le 1 ]; then + printf '\nThe repository %s (%s) knows the current revision %s, but it is not a commit, but a %s.\n' \ + "${repo}" "${repo_path}" "${repo_revision}" "${obj_type}" >> \ + "${tmp_dir}/messages" + fi + i_am_insane fi done |