File: gime-git-rev.sh

package info (click to toggle)
libreswan 5.2-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 81,632 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (20 lines) | stat: -rwxr-xr-x 410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# Reverse engineer things like:
#    3.18-51-g00a7f80-dirty-branch
#    3.18-51-g00a7f80
if test $# -lt 1 ; then
    cat <<EOF
Usage:
    $0 <result-directory> ...
Reverse engineer the git revision from a result directory.
EOF
    exit 1
fi

for d in "$@" ; do
    basename ${d} | \
	sed -n \
	    -e 's;^[^-]*-[0-9]*-g\([0-9a-f]*\)-[^/]*$;\1;p' \
	    -e 's;^[^-]*-[0-9]*-g\([0-9a-f]*\);\1;p'
done