|
|
|
@ -19,7 +19,6 @@ setup() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@test "syncing correctly" {
|
|
|
|
|
|
|
|
|
|
# Start up gitwatch and see if commit and push happen automatically
|
|
|
|
|
# after waiting two seconds
|
|
|
|
|
${BATS_TEST_DIRNAME}/gitwatch.sh -r origin "$testdir/local/remote" 3>- &
|
|
|
|
@ -84,9 +83,8 @@ setup() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "commit log messages working" {
|
|
|
|
|
|
|
|
|
|
# Start up gitwatch with logging, see if works
|
|
|
|
|
${BATS_TEST_DIRNAME}/gitwatch.sh -l 10 "$testdir/local/remote" 3>- &
|
|
|
|
|
${BATS_TEST_DIRNAME}/gitwatch.sh -l 10 "$testdir/local/remote" 3>&- &
|
|
|
|
|
GITWATCH_PID=$!
|
|
|
|
|
|
|
|
|
|
# Keeps kill message from printing to screen
|
|
|
|
@ -110,11 +108,40 @@ setup() {
|
|
|
|
|
|
|
|
|
|
# Check commit log that the diff is in there
|
|
|
|
|
run git log -1 --oneline
|
|
|
|
|
echo "# Output is $output" >&3
|
|
|
|
|
[[ $output == *"file1.txt"* ]]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@test "commit only when git status change" {
|
|
|
|
|
|
|
|
|
|
# Start up gitwatch and capture its output
|
|
|
|
|
${BATS_TEST_DIRNAME}/gitwatch.sh "$testdir/local/remote" > "$testdir/output.txt" 3>&- &
|
|
|
|
|
GITWATCH_PID=$!
|
|
|
|
|
|
|
|
|
|
# Keeps kill message from printing to screen
|
|
|
|
|
disown
|
|
|
|
|
|
|
|
|
|
# Create a file, verify that it hasn't been added yet, then commit
|
|
|
|
|
cd remote
|
|
|
|
|
|
|
|
|
|
# According to inotify documentation, a race condition results if you write
|
|
|
|
|
# to directory too soon after it has been created; hence, a short wait.
|
|
|
|
|
sleep 1
|
|
|
|
|
echo "line1" >> file1.txt
|
|
|
|
|
|
|
|
|
|
# Wait a bit for inotify to figure out the file has changed, and do its add,
|
|
|
|
|
# and commit
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
# Touch the file, but no change
|
|
|
|
|
touch file1.txt
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
run bash -c "grep \"nothing to commit\" \"$testdir/output.txt\" | wc -l"
|
|
|
|
|
[[ $output == "0" ]]
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
teardown() {
|
|
|
|
|
# Remove testing directories
|
|
|
|
|
cd /tmp
|
|
|
|
|