2018-10-26 17:43:50 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-11-01 14:07:14 +00:00
|
|
|
set -x
|
|
|
|
|
2019-09-19 14:41:49 +00:00
|
|
|
# doesn't actually cd to directory, but return absolute path
|
2018-10-26 17:43:50 +00:00
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2019-09-19 14:41:49 +00:00
|
|
|
# cd to directory
|
|
|
|
cd $CUR_DIR
|
2018-10-26 17:43:50 +00:00
|
|
|
|
|
|
|
CONTRIBUTORS_FILE=${CONTRIBUTORS_FILE=$CUR_DIR/StorageSystemContributors.generated.cpp}
|
|
|
|
|
2019-09-19 14:41:49 +00:00
|
|
|
# if you don't specify HEAD here, without terminal `git shortlog` would expect input from stdin
|
|
|
|
git shortlog HEAD --summary | perl -lnE 's/^\s+\d+\s+(.+)/ "$1",/; next unless $1; say $_' > $CONTRIBUTORS_FILE.tmp
|
2018-10-26 17:43:50 +00:00
|
|
|
|
|
|
|
# If git history not available - dont make target file
|
|
|
|
if [ ! -s $CONTRIBUTORS_FILE.tmp ]; then
|
2018-11-01 14:07:14 +00:00
|
|
|
echo Empty result of git shortlog
|
2019-06-20 23:50:53 +00:00
|
|
|
git status -uno
|
2018-10-26 17:43:50 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "// autogenerated by $0" > $CONTRIBUTORS_FILE
|
|
|
|
echo "const char * auto_contributors[] {" >> $CONTRIBUTORS_FILE
|
|
|
|
cat $CONTRIBUTORS_FILE.tmp >> $CONTRIBUTORS_FILE
|
2018-11-01 18:01:10 +00:00
|
|
|
echo -e " nullptr};" >> $CONTRIBUTORS_FILE
|
2018-10-26 17:43:50 +00:00
|
|
|
|
2018-11-01 14:07:14 +00:00
|
|
|
echo "Collected `cat $CONTRIBUTORS_FILE.tmp | wc -l` contributors."
|
2018-10-26 17:43:50 +00:00
|
|
|
rm $CONTRIBUTORS_FILE.tmp
|
2018-11-01 14:07:14 +00:00
|
|
|
|