95ba5f01-6416-482f-b4af-d506b871e4bd
[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}"
21 cd ..
22 cp -r "${project}" "${temp_project_dir}"
23 cd "${temp_project_dir}"
24 if make test; then
25 cd "../${project}"
26 git add .
27 git commit -am "${uuid}
28
29${datetime}"
30 fi
31 cd ..
32 rm -rf "${temp_project_dir}"
33 cd "${project}"
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/>.