Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't touch git files on #cleanup #337

Closed
wants to merge 1 commit into from
@bogdan

In my usecase I built site on local machine and push it to github repository.
Probably every person that uses modified version of jekyll would do this in order to have flexibility to change source and use github for hosting.

So jekyll should not remove .git repository during Site#proccess.

@bogdan bogdan Site#clean: Make .git directory stay
When site content destination is a git repository
It is a good idea to skip the .git directory
7af355f
@MikeSchroll

+1 - This would be great - however there's a bug in this commit, it can't have $ at the end, or it still deletes all files in .git

An even better solution would be to have the exclude list as a configuration variable so anyone can add what they want, and default config can include a commented out list of .svn, .git, etc., etc.

@skuro

+1

As plugins are disabled for Github Pages, the target folder will most likely have a .git folder that has to stay. @MikeSchroll idea of having configurable excludes seems reasonable.

@neoascetic

bump

@toblux

+1

@vanto

+1

@parkr
Owner

+1. We're building out a site that would be best if we can keep a .git repository in _site. It'd be awesome if that weren't deleted upon build.

@parkr
Owner

Check out my pull request: #556. I think you'll find that this is suitable. Thoughts, @MikeSchroll and @bogdan?

@bogdan

I like @MikeSchroll 's idea to have configuration option to exclude some files from cleanup process and make it default to .git .svn etc.

@MikeSchroll

@parkr Looks great!
Agree with @bogdan that we might as well store the list of extensions as a configurable variable, pre-populated with the most common appropriate .dotfiles

@parkr
Owner

Great! I'll rework it very soon. Thanks!

@parkr parkr referenced this pull request
Closed

Added cleanup config #540

@tombell

Why are people creating a repo inside of _site when you can just version control the source of the static site?

@bogdan

Because when generate _site locally you can change jekyll runtime. E.g. overwrite methods, write custom ruby code, use jekyll from your own fork.

@edeustace

I've created a pull request based on parkr's one #556: #630
It adds a configuration variable: keep_files which defaults to ['.git'].

@parkr
Owner

Whaddaya think, @bogdan? Also, @tombell, my answer to your question: antiquated production servers used @ Cornell serve just the raw stuff (do not serve using WEBrick/Thin which would just serve the "compiled" files) so we have to version control just the output and rsync it with the server.

@bogdan bogdan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2011
  1. @bogdan

    Site#clean: Make .git directory stay

    bogdan authored
    When site content destination is a git repository
    It is a good idea to skip the .git directory
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +1 −1  lib/jekyll/site.rb
  2. +3 −0  test/test_site.rb
View
2  lib/jekyll/site.rb
@@ -210,7 +210,7 @@ def cleanup
# all files and directories in destination, including hidden ones
dest_files = Set.new
Dir.glob(File.join(self.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
- dest_files << file unless file =~ /\/\.{1,2}$/
+ dest_files << file unless file =~ /\/\.{1,2}$/ || file =~/\/\.git$/
end
# files to be written
View
3  test/test_site.rb
@@ -146,6 +146,7 @@ class TestSite < Test::Unit::TestCase
File.open(dest_dir('qux/obsolete.html'), 'w')
# empty directory
FileUtils.mkdir(dest_dir('quux'))
+ FileUtils.mkdir(dest_dir('.git'))
end
teardown do
@@ -153,6 +154,7 @@ class TestSite < Test::Unit::TestCase
FileUtils.rm_f(dest_dir('obsolete.html'))
FileUtils.rm_rf(dest_dir('qux'))
FileUtils.rm_f(dest_dir('quux'))
+ FileUtils.rm_rf(dest_dir('.git'))
end
should 'remove orphaned files in destination' do
@@ -161,6 +163,7 @@ class TestSite < Test::Unit::TestCase
assert !File.exist?(dest_dir('obsolete.html'))
assert !File.exist?(dest_dir('qux'))
assert !File.exist?(dest_dir('quux'))
+ assert File.exist?(dest_dir('.git'))
end
end
Something went wrong with that request. Please try again.