Skip to content

Instantly share code, notes, and snippets.

@prophile
Created December 3, 2013 14:30
Show Gist options
  • Select an option

  • Save prophile/7770070 to your computer and use it in GitHub Desktop.

Select an option

Save prophile/7770070 to your computer and use it in GitHub Desktop.
A script for testing content differences on whitespace changes in srweb
#!/bin/bash
# Usage: review-ws (gerrit change number) when in an srweb clone
SSH_HOST=badger
set -e
REF=$(ssh $SSH_HOST gerrit query --current-patch-set $1 | grep '^ ref: ' | cut -d' ' -f6)
git fetch https://www.studentrobotics.org/gerrit/srweb $REF
git checkout FETCH_HEAD
FILES=$(git diff --name-only HEAD~1 HEAD | grep '^content/en')
for FILE in $FILES
do
git show HEAD:$FILE | sed '1,5d' | pandoc -f markdown_phpextra -t markdown > /tmp/review-latest.md
git show HEAD~1:$FILE | sed '1,5d' | pandoc -f markdown_phpextra -t markdown > /tmp/review-prev.md
if ! diff /tmp/review-prev.md /tmp/review-latest.md >/dev/null ; then
echo -en "\033[47;31m" # Red
echo "$FILE differs in content."
tput sgr0
else
echo -en "\033[47;32m" # Green
echo "$FILE has no content differences."
tput sgr0
fi
done
@PeterJCLaw
Copy link

does that parse the markdown, and then output markdown!?

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