#! /usr/bin/env bash # GNU AGPLv3 (or later at your option) # see bottom for more license info. # please keep this notice. # This file is part of coding-replay. set -o nounset set -o errexit project="$(basename "$(pwd)")" while sleep 1; do if ! git diff-index --quiet HEAD --\ || \ ! git ls-files --other --directory --exclude-standard | sed q1; then datetime=$(date -u '+%Y-%m-%d-%H-%M-%S.%N') uuid=$(uuid -v4) temp_project_dir="${project}-${datetime}-${uuid}" cd .. || exit 1 # in case cd fails cp -r "${project}" "${temp_project_dir}" cd "${temp_project_dir}" || exit 1 # in case cd fails if make test; then cd "../${project}" || exit 1 # in case cd fails git add . git commit -am "${uuid} ${datetime}" fi cd .. || exit 1 # in case cd fails rm -rf "${temp_project_dir}" cd "${project}" || exit 1 # in case cd fails fi done # coding-replay is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # coding-replay is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public # License along with coding-replay. If not, see # .