e4fa4e21-a400-4256-be7d-4bf45aee31b0
[coding-replay] / coding-replay.bash
CommitLineData
200e5ef2 1#! /usr/bin/env bash
2
3# GNU AGPLv3 (or later at your option)
4# see bottom for more license info.
5# please keep this notice.
6# This file is part of coding-replay.
7
8set -o nounset
9set -o errexit
10
c42a28df 11project="$(basename "$(pwd)")"
200e5ef2 12
13while sleep 1; do
14 if ! git diff-index --quiet HEAD --\
15 || \
16 ! git ls-files --other --directory --exclude-standard | sed q1;
17 then
18 datetime=$(date -u '+%Y-%m-%d-%H-%M-%S.%N')
19 uuid=$(uuid -v4)
20 temp_project_dir="${project}-${datetime}-${uuid}"
5570cc72 21 cd .. || exit 1 # in case cd fails
200e5ef2 22 cp -r "${project}" "${temp_project_dir}"
5570cc72 23 cd "${temp_project_dir}" || exit 1 # in case cd fails
200e5ef2 24 if make test; then
5570cc72 25 cd "../${project}" || exit 1 # in case cd fails
200e5ef2 26 git add .
27 git commit -am "${uuid}
28
29${datetime}"
30 fi
5570cc72 31 cd .. || exit 1 # in case cd fails
200e5ef2 32 rm -rf "${temp_project_dir}"
5570cc72 33 cd "${project}" || exit 1 # in case cd fails
200e5ef2 34 fi
35done
36
37# coding-replay is free software: you can redistribute it and/or modify it
38# under the terms of the GNU Affero General Public License as published
39# by the Free Software Foundation, either version 3 of the License, or
40# (at your option) any later version.
41
42# coding-replay is distributed in the hope that it will be useful, but
43# WITHOUT ANY WARRANTY; without even the implied warranty of
44# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45# GNU Affero General Public License for more details.
46
47# You should have received a copy of the GNU Affero General Public
48# License along with coding-replay. If not, see
49# <http://www.gnu.org/licenses/>.