qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qemu v2] git-submodule.sh: Do not try writing to source directory if not necessary
@ 2017-10-26  1:34 Alexey Kardashevskiy
  2017-10-26  7:13 ` Darren Kenny
  2017-10-26 12:23 ` Daniel P. Berrange
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-26  1:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Daniel P. Berrange

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-26 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  1:34 [Qemu-devel] [PATCH qemu v2] git-submodule.sh: Do not try writing to source directory if not necessary Alexey Kardashevskiy
2017-10-26  7:13 ` 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

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).