forked from bulletmark/libinput-gestures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist-version-hashes
executable file
·61 lines (50 loc) · 1.25 KB
/
list-version-hashes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# M.Blakeney, Oct 2018.
PROG="$(basename $0)"
PROGDIR="$(dirname $0)"
SUMPROG="md5sum"
usage() {
echo "Usage: $PROG [-options] [hashsum]"
echo "Development utility to list version and hash sums, and flag those that"
echo "match given hash sum. Must be run from the libinput-gestures git repo dir."
echo "Options: (none)"
exit 1
}
# Process command line options
while getopts \? c; do
case $c in
\?) usage;;
esac
done
shift $((OPTIND - 1))
if [[ $# -eq 1 ]]; then
HASHSUM="$1"
elif [[ $# -ne 0 ]]; then
usage
else
HASHSUM=""
fi
output() {
local tag=$1
local hashsum=${2/ */}
if [[ -n $HASHSUM && $HASHSUM == $hashsum ]]; then
found=" *"
else
found=""
fi
printf "%-24s %s%s\n" $tag $hashsum "$found"
}
cd ${PROGDIR:-.} || exit 1
# Iterate through all tags and output the md5 hash for each version
tag=""
while read hashc; do
tag=$(git describe --tags --always $hashc)
hashsum=$(git show $hashc:libinput-gestures | $SUMPROG)
output $tag $hashsum
done <<< "$(git rev-list --all --reverse)"
# Output a version for the working tree as well
tagw=$(git describe --tags --always --dirty)
if [[ $tagw != $tag ]]; then
hashsum=$($SUMPROG libinput-gestures)
output $tagw $hashsum
fi