|
9 | 9 |
|
10 | 10 | // next line shall define either OH_VERSION or LAST_OH_VERSION
|
11 | 11 | //
|
12 |
| -#define LAST_OH_VERSION "3.3.0" |
| 12 | +#define OH_VERSION "3.3.0.1" |
13 | 13 |
|
14 | 14 |
|
15 | 15 | // do not edit below
|
|
25 | 25 | #endif
|
26 | 26 | #endif
|
27 | 27 |
|
| 28 | +/* content of ".git/hooks/pre-commit": |
| 29 | +
|
| 30 | +#!/bin/sh |
| 31 | +
|
| 32 | +# this script is automatically run before committing |
| 33 | +# it provides version info (shown in top line of the program) |
| 34 | +# inspired by: https://gist.github.com/sg-s/2ddd0fe91f6037ffb1bce28be0e74d4e |
| 35 | +
|
| 36 | +# this file will be updated automatically by every commit |
| 37 | +# |
| 38 | +OH_BUILD_H="$(git rev-parse --show-toplevel)"/openhantek/src/OH_BUILD.h |
| 39 | +
|
| 40 | +# commit date |
| 41 | +# |
| 42 | +DATE=$(date +%Y%m%d) |
| 43 | +
|
| 44 | +# number of this commit (i.e. number of previous commits + 1) |
| 45 | +# |
| 46 | +COMMIT=$(( $(git log main --pretty=oneline | wc -l) + 1 )) |
| 47 | +
|
| 48 | +# define a string with commit date and number of this commit |
| 49 | +# |
| 50 | +echo "// Do not edit, will be re-created at each commit!" > ${OH_BUILD_H} |
| 51 | +echo "#define OH_BUILD \"$DATE - commit $COMMIT\"" >> ${OH_BUILD_H} |
| 52 | +
|
| 53 | +# and finally stage the change |
| 54 | +# |
| 55 | +git add ${OH_BUILD_H} |
| 56 | +
|
| 57 | +*/ |
| 58 | + |
28 | 59 | /* content of ".git/hooks/post-commit":
|
29 | 60 |
|
30 | 61 | #!/bin/bash
|
|
33 | 64 | # it tags the commit if a version is defined in the version file
|
34 | 65 | # inspired by: https://coderwall.com/p/mk18zq/automatic-git-version-tagging-for-npm-modules
|
35 | 66 |
|
36 |
| -# this file was updated during development (by hand) |
| 67 | +# this file was updated during development (by script build/MK_NEW_VER) |
37 | 68 | #
|
38 |
| -OH_VERSION_H=openhantek/src/OH_VERSION.h |
| 69 | +OH_VERSION_H="$(git rev-parse --show-toplevel)"/openhantek/src/OH_VERSION.h |
39 | 70 |
|
40 | 71 | # check if the last commit changed the entry OH_VERSION in file ...OH_VERSION.h and extract the new version
|
41 | 72 | #
|
42 |
| -OH_VERSION=$(git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/${OH_VERSION_H} |
43 |
| - | awk '/^\+\#define OH_VERSION/ { print $3 }' | tr -d '"') |
| 73 | +OH_VERSION=$(git diff HEAD^..HEAD -- ${OH_VERSION_H} | awk '/^\+#define OH_VERSION/ { print $3 }' | tr -d '"') |
44 | 74 |
|
45 | 75 | # if commit was marked as OH_VERSION then tag it accordingly and change entry to LAST_OH_VERSION
|
46 | 76 | #
|
|
0 commit comments