mu/snapshot_lesson
Kartik K. Agaram ba838feae9 4211
Just ran into first issue from using the portable /bin/sh rather than a
modern shell:
  https://stackoverflow.com/questions/15744421/read-command-doesnt-wait-for-input

Turn on errexit everywhere.
2018-02-20 01:38:15 -08:00

13 lines
365 B
Bash
Executable File

#!/bin/sh
# Hacky little helper called from edit/ and sandbox/ apps to save a snapshot
# of lesson/ using git.
set -e
test -d lesson/.git || exit 0 # give up if it's not a git repo
cd lesson
# explicitly say '--all' for git 1.9
git add --all .
# bug in git: git diff -q messes up --exit-code
git diff HEAD --exit-code >/dev/null || git commit -a -m . >/dev/null