summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-10-12 17:44:57 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-10-12 17:44:59 +0200
commit05d43128ceef3db89095d2ee2b83acf357ea2fde (patch)
tree8be2ac0598d2a346779db340e794ba1c106c5178 /scripts
parent4beeef080b4e07eaa1ee3bd3b9f918e425996142 (diff)
Update script
Basically a complete rewrite. This now is able to parse git installed imag version strings and behave accordingly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/which-commands-changed23
1 files changed, 17 insertions, 6 deletions
diff --git a/scripts/which-commands-changed b/scripts/which-commands-changed
index 62a48593..4a179633 100755
--- a/scripts/which-commands-changed
+++ b/scripts/which-commands-changed
@@ -2,11 +2,22 @@
# Find all imag commands which changed since last install
-imag versions |\
-grep "imag-" |\
-sed 's,v.*-g,,' |\
+imag versions 2>&1 | \
+grep "imag-" | \
+sed 's,\ *->.*\ , ,' | \
while read binary hash; do
- git diff "$hash..master" --name-only | \
- grep "$binary" >/dev/null 2>/dev/null && \
- echo "$binary changed since last install (was $hash)"
+ if [[ "$hash" =~ v.*\..*\..*- ]]; then
+ hash="$(echo "$hash" | sed 's,.*-g,,')"
+ fi
+
+ log="$(git diff --name-only ${hash}..master 2>/dev/null)"
+ if [[ $? -eq 0 ]]; then
+ echo "$log" | \
+ grep "$binary" >/dev/null 2>/dev/null && \
+ echo -e "changed since last install ($hash): $binary"
+ else
+ echo "WARN: Could not check $binary because git hash '$hash' is not present"
+ fi
+
done
+