diff --git a/.gitignore b/.gitignore index 6c54293..d9bc9cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -# Note! Please use 'git ls-files -i --exclude-standard' -# command after changing this file, to see if there are -# any tracked files which get ignored after the change. +# Note! Please run 'prove t/gitignore.t' after changing +# this file, to check its coherency # all dotfiles .* diff --git a/t/gitignore.t b/t/gitignore.t new file mode 100644 index 0000000..90904cd --- /dev/null +++ b/t/gitignore.t @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w +# +# Test that .gitignore is coherent +# +# Stéphane (kwisatz) Jourdois +# -- +# + +use strict; +use Test::More tests => 3; + +BEGIN { use_ok( 'Git' ); } + + +# First, check that no tracked files are ignored +my $cmd = Git::command_output_pipe('ls-files', '--ignored', '--exclude-standard'); +my $output; +while (<$cmd>) { $output .= "--> $_" } +close $cmd; + +ok(!defined $output, 'No tracked file is ignored') + or diag(<) { $output .= "--> $_" } +close $cmd; + +ok(!defined $output, 'No untracked file is present') + or diag(<