From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PATCH qemu v2] git-submodule.sh: Do not try writing to source directory if not necessary
Date: Thu, 26 Oct 2017 12:34:45 +1100 [thread overview]
Message-ID: <20171026013445.45605-1-aik@ozlabs.ru> (raw)
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 <aik@ozlabs.ru>
---
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
+substat_tmp=$(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=$?
+rm "${substat_tmp}" 2>/dev/null
+exit $myret
--
2.11.0
next reply other threads:[~2017-10-26 1:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-26 1:34 Alexey Kardashevskiy [this message]
2017-10-26 7:13 ` [Qemu-devel] [PATCH qemu v2] git-submodule.sh: Do not try writing to source directory if not necessary Darren Kenny
2017-10-26 8:18 ` Alexey Kardashevskiy
2017-10-26 8:51 ` Darren Kenny
2017-10-26 9:03 ` Alexey Kardashevskiy
2017-10-26 10:25 ` Darren Kenny
2017-10-26 12:23 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171026013445.45605-1-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).