summaryrefslogtreecommitdiff
path: root/bin/nit-picker
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-12 12:20:23 +0200
committerErich Eckner <git@eckner.net>2019-07-12 12:20:23 +0200
commit60e7ab278cbed710f09178046d1f9880a8ee68fb (patch)
tree2286f1eb46abd832e8e2e8c176728eb2f5d9c882 /bin/nit-picker
parent0eaebfdbf909df390fa655756d32409d0811402b (diff)
downloadbuilder-60e7ab278cbed710f09178046d1f9880a8ee68fb.tar.xz
bin/nit-picker: check if commit is ahead of HEAD
Diffstat (limited to 'bin/nit-picker')
-rwxr-xr-xbin/nit-picker26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/nit-picker b/bin/nit-picker
index 50524e9..87c7b92 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -87,6 +87,7 @@ while pgrep -x ii >/dev/null \
printf 'SELECT DISTINCT'
printf ' "commit",'
printf '`git_repositories`.`name`,'
+ printf '`git_repositories`.`head`,'
printf '`package_sources`.`git_revision`'
printf ' FROM `package_sources`'
mysql_join_package_sources_upstream_repositories
@@ -96,6 +97,9 @@ while pgrep -x ii >/dev/null \
printf 'SELECT DISTINCT'
printf ' "commit",'
printf '"archlinux32",'
+ # shellcheck disable=SC2154
+ printf '"%s",' \
+ "${repo_heads__archlinux32}"
printf '`package_sources`.`mod_git_revision`'
printf ' FROM `package_sources`'
printf ';\n'
@@ -121,6 +125,8 @@ while pgrep -x ii >/dev/null \
'commit') # check whether a given commit is present in the git repo
git_repo="${parameters%% *}"
git_rev="${parameters#${git_repo} }"
+ git_head="${parameters%% *}"
+ git_rev="${git_rev#${git_head} }"
eval "$(
printf 'git_dir="${repo_paths__%s}"\n' \
"${git_repo}"
@@ -137,6 +143,26 @@ while pgrep -x ii >/dev/null \
| irc_say
fi
fi
+ # shellcheck disable=SC2154
+ if ! git -C "${git_dir}" cat-file -t "${git_head}" 2> /dev/null | \
+ grep -qxF 'commit'; then
+ git -C "${git_dir}" fetch --all -p >/dev/null 2>&1
+ if ! git -C "${git_dir}" cat-file -t "${git_head}" 2> /dev/null | \
+ grep -qxF 'commit'; then
+ printf 'commit %s is missing from repository %s\n' \
+ "${git_head}" \
+ "${git_repo}" \
+ | irc_say
+ fi
+ fi
+ # shellcheck disable=SC2154
+ if ! git -C "${git_dir}" merge-base --is-ancestor "${git_rev}" "${git_head}" 2> /dev/null; then
+ printf 'commit %s is not an ancestor of HEAD %s in repository %s\n' \
+ "${git_rev}" \
+ "${git_head}" \
+ "${git_repo}" \
+ | irc_say
+ fi
;;
'binary-dependencies')
${master_mirror_rsync_command} \