Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects

Resolve "better solution to create/update src/OPALrevision.h"

Merged gsell requested to merge 346-better-solution-to-create-update-src-opalrevision-h-3 into master
1 file
+ 23
10
Compare changes
  • Side-by-side
  • Inline
gen_OPALrevision 100644 → 100755
+ 23
10
#!/bin/bash
#
# rewritting 'src/OPALrevision.h'
# if a git binary is in $PATH and we are in a Git work tree; then
# write the Git revision
# if
# (a git binary does not exist in $PATH or we are in a Git work tree)
# and the file does not exist; then write "unknown"
# create/rewrite 'src/OPALrevision.h'
#
function print {
print () {
echo '#define GIT_VERSION '\"$1\" > src/OPALrevision.h
exit $?
}
which -a git &> /dev/null || print unknown
# if git(1) is not in $PATH
if ! which -a git &> /dev/null; then
if [[ -e src/OPALrevision.h ]]; then
# do nothing if file exist
exit 0
else
# otherwise create file
print unknown
exit $?
fi
fi
# if we are in a work-tree
if git rev-parse --is-inside-work-tree &> /dev/null; then
# create/rewrite file
revision=$(git rev-parse HEAD)
print ${revision}
elif [[ ! -e src/OPALrevision.h ]]; then
exit $?
fi
# if we are not in a work tree and the file does not exist
if [[ ! -e src/OPALrevision.h ]]; then
# create file
print unknown
exit $?
fi
exit 0
\ No newline at end of file
Loading