From nobody Sun May 19 07:16:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508981847894245.691226892734; Wed, 25 Oct 2017 18:37:27 -0700 (PDT) Received: from localhost ([::1]:50544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7X6n-0004zh-Iv for importer@patchew.org; Wed, 25 Oct 2017 21:37:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7X4N-0003bE-HO for qemu-devel@nongnu.org; Wed, 25 Oct 2017 21:34:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7X4K-0006xg-FD for qemu-devel@nongnu.org; Wed, 25 Oct 2017 21:34:51 -0400 Received: from ozlabs.ru ([107.173.13.209]:57096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7X4K-0006xW-90 for qemu-devel@nongnu.org; Wed, 25 Oct 2017 21:34:48 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 624473A60066; Wed, 25 Oct 2017 21:33:40 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 12:34:45 +1100 Message-Id: <20171026013445.45605-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v2] git-submodule.sh: Do not try writing to source directory if not necessary X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The new git-submodule.sh script writes .git-submodule-status to the source directory every time no matter what. This makes it conditional. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * fixed "status" branch too --- scripts/git-submodule.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh index d8fbc7e47e..ae038d2e58 100755 --- a/scripts/git-submodule.sh +++ b/scripts/git-submodule.sh @@ -23,16 +23,21 @@ then exit 1 fi =20 +substat_tmp=3D$(mktemp) + case "$command" in status) test -f "$substat" || exit 1 - trap "rm -f ${substat}.tmp" EXIT - git submodule status $modules > "${substat}.tmp" - diff "${substat}" "${substat}.tmp" >/dev/null - exit $? + git submodule status $modules > "$substat_tmp" + diff "${substat_tmp}" "${substat}" > /dev/null ;; update) git submodule update --init $modules 1>/dev/null 2>&1 - git submodule status $modules > "${substat}" + git submodule status $modules > "$substat_tmp" + diff "${substat_tmp}" "${substat}" || mv "${substat_tmp}" "${substat}" ;; esac + +myret=3D$? +rm "${substat_tmp}" 2>/dev/null +exit $myret --=20 2.11.0