From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id EEED46EC56; Thu, 18 Mar 2021 14:24:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EEED46EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616066674; bh=Q3KNeVRhQrc/FIiaVNOX4/oWIUMy6pTygd7wlI5FU7g=; h=To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=naV32YMVGocF2ehjgzf4r7OPOXa00Wlee+M5v1tiMOjBtx60vhMMJbBEX7UzbEGpR oCXxhIPVe5KAVRso0iF94YZVj8VUypM3WQV1tnKmI1i68F6byW81lak72xNqjWSRAe Bxjh4W3ZTEN45rhMorGza+vAJ1VAp2Je5lml9Fkk= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 276206EC56 for ; Thu, 18 Mar 2021 14:24:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 276206EC56 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lMqlU-00074O-7V; Thu, 18 Mar 2021 14:24:32 +0300 To: tarantool-patches@dev.tarantool.org Cc: alexander.turenko@tarantool.org Date: Thu, 18 Mar 2021 14:24:31 +0300 Message-Id: <1616066671-24689-1-git-send-email-alyapunov@tarantool.org> X-Mailer: git-send-email 2.7.4 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD96485A7A9FC131893DA79D6515A0F039B4831FD7FB0219397182A05F538085040B44A415D8E531DCD7D960415A451970CF24B6318760B6EF82DFC87A7DEDCE683 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CB1634DB9A2F7B99EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063749A0D61DF1984B008638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CF89CA98302ED496F2D4E19F3A16CA71F5E234637F6C18C6DA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C34964A708C60C975A117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C22491D03AD84C159F5EA089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7C5F8D410C35C2E63743847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148FA8EF81845B15A4842623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CF89CA98302ED496F2D4E19F3A16CA71F5E234637F6C18C6D9C2B6934AE262D3EE7EAB7254005DCEDB1902867F2B8813992E1F3B950BCE21616EB5DE968479BF5B2CF3E77A3BD9B2CBDC6A1CF3F042BAD6DF99611D93F60EFA70DDFFB3186CBC5699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348F343DA43F62289FCDDA55DA74F974AD31B297EBACB48EB55131A4617F7BFD03DFDAF700B83516931D7E09C32AA3244C2E46258B34430BA1393B5A31AA6C1F65F2F5F14F68F1805B729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXjJTE7swvbRk4AGJ0KFiYcQ X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822151D27F3F663BFFC685839065844A367768B24048D282DA2530DB6A6B741C87FFB559BB5D741EB9687DA18E135A33682FD657A8799238ED567EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH] tools: add a script that checks submodules' commits X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Aleksandr Lyapunov via Tarantool-patches Reply-To: Aleksandr Lyapunov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sometimes to fix an issue we need to patch our submodule, update it in tarantool and then patch tarantool using changes in submodule. During development and review stages we have to create a branch (S) in submodule and a branch (T) in tarantool that references head of (S) branch. When the fix is merged to mater it's very simple to make a mistake: merge-and-push submodule's branch S and then tarantool's branch T. It sounds obvious, but that's wrong: tarantool's master should reference a commit from submodule's master, not a commit from temporary developer's branch. It's not hard to fix it but still a maintainer must always remember that problem. In order to simplify their life it was decided to create a script that is designed to check such thing before pushing tarantool to origin/master. Here is it, with simple usage: ./tools/check_push_master.sh && git push origin master --- tools/check_push_master.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tools/check_push_master.sh diff --git a/tools/check_push_master.sh b/tools/check_push_master.sh new file mode 100755 index 0000000..5bc2762 --- /dev/null +++ b/tools/check_push_master.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This script is recommended to run before pushing master to origin. +# It fails (returns 1) if a problem detected, see output. +exit_status=0 + +# Check that submodules' commits are from their master branches. +# The script checks all submodules, but fails only for the following list: +our_submodules="src/lib/msgpuck:src/lib/small:test-run" + +function check_submodule() { + local submodule_path=$1 + local commit=$2 + git "--git-dir=$(git rev-parse --show-toplevel)/$submodule_path/.git" branch -r --contains $commit | egrep " origin/master$" > /dev/null + local commit_is_from_master=$? + [[ ":$our_submodules:" =~ ":$submodule_path:" ]] + local it_is_our_submodule=$? + if [[ $it_is_our_submodule -eq 0 ]] && [[ $commit_is_from_master -eq 1 ]]; then + echo "Submodule $submodule_path is set to commit $commit that is not in master branch!" + exit_status=1 + fi +} + +while read -r line; do + check_submodule $line +done <<<"`git "--git-dir=$(git rev-parse --show-toplevel)/.git" ls-tree -r HEAD | egrep "^[0-9]+ commit" | awk '{print $4 " " $3}'`" + +# Done +exit $exit_status \ No newline at end of file -- 2.7.4