diff --git a/Vagrantfile b/Vagrantfile index bf66487..9347271 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -339,6 +339,37 @@ Vagrant.configure(2) do |config| EOF + # A sample Git repository + # This uses cd because it's easier than telling Git where to go each time + config.vm.provision :shell, privileged: false, inline: <<-EOF + set -xe + mkdir "#{test_dir}/git" + cd "#{test_dir}/git" + git init + + mkdir edits additions moves + + echo "original content" | tee edits/{staged,unstaged,both} + echo "this file gets moved" > moves/hither + + git add edits moves + git commit -m "Automated test commit" + + + echo "modifications!" | tee edits/{staged,both} + touch additions/{staged,edited} + mv moves/{hither,thither} + + git add edits moves additions + echo "more modifications!" | tee edits/unstaged edits/both additions/edited + touch additions/unstaged + + + touch -t #{some_date} "#{test_dir}/git/"*/* + sudo chown #{user}:#{user} -R "#{test_dir}/git" + EOF + + # Install kcov for test coverage # This doesn’t run coverage over the xtests so it’s less useful for now if ENV.key?('INSTALL_KCOV') diff --git a/xtests/git_additions b/xtests/git_additions new file mode 100644 index 0000000..dfd68cb --- /dev/null +++ b/xtests/git_additions @@ -0,0 +1,3 @@ +.rw-rw-r-- 20 cassowary  1 Jan 12:34 NM edited +.rw-rw-r-- 0 cassowary  1 Jan 12:34 N- staged +.rw-rw-r-- 0 cassowary  1 Jan 12:34 -N unstaged diff --git a/xtests/git_edits b/xtests/git_edits new file mode 100644 index 0000000..db78006 --- /dev/null +++ b/xtests/git_edits @@ -0,0 +1,3 @@ +.rw-rw-r-- 20 cassowary  1 Jan 12:34 MM both +.rw-rw-r-- 15 cassowary  1 Jan 12:34 M- staged +.rw-rw-r-- 20 cassowary  1 Jan 12:34 -M unstaged diff --git a/xtests/run.sh b/xtests/run.sh index b9e8b49..770d7a6 100755 --- a/xtests/run.sh +++ b/xtests/run.sh @@ -101,4 +101,9 @@ COLUMNS=80 $exa $testcases/links 2>&1 | diff -q - $results/links || ex $exa $testcases/links/* -1 | diff -q - $results/links_1_files || exit 1 +# Git +$exa $testcases/git/additions -l --git 2>&1 | diff -q - $results/git_additions || exit 1 +$exa $testcases/git/edits -l --git 2>&1 | diff -q - $results/git_edits || exit 1 + + echo "All the tests passed!"