From e18dcc7f2b6f75ff2caea1d9b6fa25e968b1718a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 7 Aug 2019 11:00:46 +0200 Subject: bin/nit-picker: re-fetch HEAD before complaining --- bin/nit-picker | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'bin/nit-picker') diff --git a/bin/nit-picker b/bin/nit-picker index 1dea301..647bfca 100755 --- a/bin/nit-picker +++ b/bin/nit-picker @@ -163,11 +163,27 @@ while pgrep -x ii >/dev/null \ 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 + current_git_head=$( + # shellcheck disable=SC2016 + { + printf 'SELECT DISTINCT' + printf ' `git_repositories`.`head`' + printf ' FROM `git_repositories`' + printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \ + "$( + printf '%s' "${git_repo}" \ + | base64 -w0 + )" + } \ + | mysql_run_query + ) + if ! git -C "${git_dir}" merge-base --is-ancestor "${git_rev}" "${current_git_head}" 2> /dev/null; then + printf 'commit %s is not an ancestor of HEAD %s in repository %s\n' \ + "${git_rev}" \ + "${current_git_head}" \ + "${git_repo}" \ + | irc_say + fi fi ;; 'binary-dependencies') -- cgit v1.2.3-54-g00ecf