From: Robert 'phaylon' Sedlacek Date: Tue, 12 Jun 2012 21:43:56 +0000 (+0000) Subject: add an empty .gitignore to a newly created snapshot X-Git-Tag: v0.000001~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=19119660967e818c2dc9e635136f6c5ed7b0eb04;p=scpubgit%2FFile-Tree-Snapshot.git add an empty .gitignore to a newly created snapshot --- diff --git a/lib/File/Tree/Snapshot.pm b/lib/File/Tree/Snapshot.pm index 3962e21..e2021d3 100644 --- a/lib/File/Tree/Snapshot.pm +++ b/lib/File/Tree/Snapshot.pm @@ -57,6 +57,10 @@ sub create { my $path = $self->storage_path; $self->_mkpath($path); $self->_git_exec('init'); + CORE::open my $fh, '>', "$path/.gitignore" + or die "Unable to write .gitignore in '$path': $!\n"; + $self->_git_exec('add', '.gitignore'); + $self->_git_exec('commit', '-m', '"Initial commit"'); return 1; } diff --git a/t/basic.t b/t/basic.t index 861db95..3f70b3e 100644 --- a/t/basic.t +++ b/t/basic.t @@ -14,6 +14,7 @@ my $tree = File::Tree::Snapshot->new( ok not($tree->exists), 'tree doesnt exist yet'; ok $tree->create, 'tree creation successful'; ok $tree->exists, 'tree does now exit'; +ok(-e "$tree_path/.gitignore", 'created .gitignore'); do { ok(my $fh = $tree->open('>', 'foo/bar.txt', mkpath => 1), 'open file');