~matthiasbeyer/imag

ref: 9b48dc27cd00fcc75917c2702dc8dc4c6493e8d3 imag/scripts/which-commands-changed -rwxr-xr-x 607 bytes
9b48dc27Matthias Beyer libimagentryref: Move from error-chain to failure 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

# Find all imag commands which changed since last install

imag versions 2>&1 | \
grep "imag-"  | \
sed 's,\ *->.*\ , ,' | \
while read binary hash; do
    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