|
|
@ -23,6 +23,7 @@ function spaces_in_target_dir { #@test
|
|
|
|
# Start up gitwatch with logging, see if works
|
|
|
|
# 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=$!
|
|
|
|
GITWATCH_PID=$!
|
|
|
|
|
|
|
|
echo "$GITWATCH_PID"
|
|
|
|
|
|
|
|
|
|
|
|
# Keeps kill message from printing to screen
|
|
|
|
# Keeps kill message from printing to screen
|
|
|
|
disown
|
|
|
|
disown
|
|
|
@ -30,22 +31,22 @@ function spaces_in_target_dir { #@test
|
|
|
|
# Create a file, verify that it hasn't been added yet, then commit
|
|
|
|
# Create a file, verify that it hasn't been added yet, then commit
|
|
|
|
cd remote
|
|
|
|
cd remote
|
|
|
|
|
|
|
|
|
|
|
|
# According to inotify documentation, a race condition results if you write
|
|
|
|
# # According to inotify documentation, a race condition results if you write
|
|
|
|
# to directory too soon after it has been created; hence, a short wait.
|
|
|
|
# # to directory too soon after it has been created; hence, a short wait.
|
|
|
|
sleep 1
|
|
|
|
# sleep 1
|
|
|
|
echo "line1" >> file1.txt
|
|
|
|
# echo "line1" >> file1.txt
|
|
|
|
|
|
|
|
|
|
|
|
# Wait a bit for inotify to figure out the file has changed, and do its add,
|
|
|
|
# # Wait a bit for inotify to figure out the file has changed, and do its add,
|
|
|
|
# and commit
|
|
|
|
# # and commit
|
|
|
|
sleep "$WAITTIME"
|
|
|
|
# sleep "$WAITTIME"
|
|
|
|
|
|
|
|
|
|
|
|
# Make a new change
|
|
|
|
# # Make a new change
|
|
|
|
echo "line2" >> file1.txt
|
|
|
|
# echo "line2" >> file1.txt
|
|
|
|
sleep "$WAITTIME"
|
|
|
|
# sleep "$WAITTIME"
|
|
|
|
|
|
|
|
|
|
|
|
# Check commit log that the diff is in there
|
|
|
|
# # Check commit log that the diff is in there
|
|
|
|
run git log -1 --oneline
|
|
|
|
# run git log -1 --oneline
|
|
|
|
[[ $output == *"file1.txt"* ]]
|
|
|
|
# [[ $output == *"file1.txt"* ]]
|
|
|
|
|
|
|
|
|
|
|
|
echo '# Teardown started' >&3
|
|
|
|
echo '# Teardown started' >&3
|
|
|
|
# Remove testing directories
|
|
|
|
# Remove testing directories
|
|
|
@ -53,14 +54,16 @@ function spaces_in_target_dir { #@test
|
|
|
|
cd /tmp
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
|
|
|
|
# Kill background process
|
|
|
|
# Kill background process
|
|
|
|
kill -9 %1
|
|
|
|
# kill -9 %1
|
|
|
|
fg
|
|
|
|
# fg
|
|
|
|
|
|
|
|
|
|
|
|
# Also make sure to kill fswatch if on Mac
|
|
|
|
# Also make sure to kill fswatch if on Mac
|
|
|
|
killall fswatch
|
|
|
|
killall fswatch || true
|
|
|
|
# Make sure gitwatch script gets killed if script stopped background
|
|
|
|
# Make sure gitwatch script gets killed if script stopped background
|
|
|
|
# Must kill the entire tree of processes generated
|
|
|
|
# Must kill the entire tree of processes generated
|
|
|
|
pkill -15 -P "$GITWATCH_PID"
|
|
|
|
pkill -15 -f gitwatch.sh
|
|
|
|
|
|
|
|
pkill -15 -f gitwatch.sh
|
|
|
|
|
|
|
|
# pkill -15 -P "$GITWATCH_PID"
|
|
|
|
|
|
|
|
|
|
|
|
echo '# Teardown complete' >&3
|
|
|
|
echo '# Teardown complete' >&3
|
|
|
|
}
|
|
|
|
}
|
|
|
|