Last active
August 29, 2015 14:16
-
-
Save msaharov/4db61398a8327b5cb1a9 to your computer and use it in GitHub Desktop.
rev.txt creator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# --------------------------------------------------------------------------- # # Functions # --------------------------------------------------------------------------- # # git repository info (like svn info) function info() { | |
#[ -z ${1} ] && fail "${FUNCNAME}: REPOSITORY DIR not set" 1 | |
#pushd ${1} >/dev/null | |
# Find base of git directory | |
#while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done | |
# Show various information about this git directory | |
if [ -d .git ]; then | |
#show version frontend alike | |
GITVERSION=$(git describe --long --abbrev=10) | |
GITVERSION=$(echo "${GITVERSION}"|sed 's%\(.*-[[:digit:]]\+-\)\(g\)\(.\{10\}$\)%\1\3%') #removing 'g' from git tag | |
GITBRANCH=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
BDATE=$(LC_ALL=C date) | |
echo "Version: ${GITVERSION} , branch: ${GITBRANCH}, build date:${BDATE}" | |
echo "== Remote URL:" | |
git remote -v | |
echo | |
REVISION=`git rev-list --all | wc -l` | |
echo "== Revision: "${REVISION} | |
echo | |
echo "== Branch: "`git branch -v | grep ^\* | sed 's/^\*[ \t]*//'` | |
echo | |
echo "== Last Changed:" | |
git log --max-count=1 | |
echo | |
echo | |
echo | |
echo "#############" | |
echo "#############" | |
echo "######" | |
echo "###### latest 300 (or less) commits:" | |
echo "######" | |
echo "#############" | |
echo "#############" | |
git log --pretty=format:'%ci - %s - %H - %an ' --abbrev-commit --max-count=300 | |
else | |
echo "'${1}' not a git repository." | |
fi | |
#popd >/dev/null | |
} | |
function fail () { | |
echo -n "SERVER ERROR: " | |
echo ${1} | |
exit ${2} | |
} | |
function error () { | |
echo -n "Error: " | |
echo ${1} | |
exit ${2} | |
} | |
info > web/rev.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment