Skip to content

Instantly share code, notes, and snippets.

@mwgamera
Created April 17, 2016 07:36
Show Gist options
  • Save mwgamera/95a53eb09e084b1145fc79ae6493a752 to your computer and use it in GitHub Desktop.
Save mwgamera/95a53eb09e084b1145fc79ae6493a752 to your computer and use it in GitHub Desktop.
#!/bin/sh
# klg, Apr 2016
set -e
UPSVN="$(git log -n 1 --format=%H --grep '^git-svn-id:' -- "$@")"
if [ -z "$UPSVN" ]; then
echo >&2 "No git-svn commit found"
exit 1
fi
REV=$(git log -n 1 --format=%B "$UPSVN" | \
sed -n 's/^git-svn-id:.*@//p' | sed 's/ .*//')
if [ -n "$(git log --oneline "$UPSVN"..)" ]; then
REV="${REV}M"
fi
echo "$REV"
@cmcqueen
Copy link

This is good for git svn on Linux etc, but not on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment