Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep .git when cleaning destinationDirectory #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

netzwerg
Copy link

When publishing a Hakyll-based site to GitHub, it is very convenient to clone the master/gh-pages branch of the destination repo directly to the _site folder.

Taking my own blog as an example:

git clone -b source https://github.com/netzwerg/netzwerg.github.com.git 
cd netzwerg.github.com
git clone -b master https://github.com/netzwerg/netzwerg.github.com.git _site 

This allows to edit the sources, build the site, and publish the final pages from a single directory tree.

Unfortunately, cabal run clean wipes the complete _site folder (including the .git folder required for the above strategy to work).

The suggested change keeps a potentially existing _site/.git folder upon clean.

Disclaimer: I am new to Hakyll/Haskell, please refactor/refine/rewrite as needed -- tia!

@nagisa
Copy link
Contributor

nagisa commented May 19, 2015

Such change was proposed multiple times and it was declined multiple times as well on the grounds of

  • destinationDirectory being owned by hakyll;
  • There existing multiple ways to track files inside directory without putting .git into it;
  • many more special directories that might want to not be deleted.

@netzwerg
Copy link
Author

Thanks for your clarifications. I must have missed the issues that already dealt with similar suggestions (or is there a mailing-list where these discussions are happening?).

@netzwerg netzwerg closed this May 20, 2015
@nagisa
Copy link
Contributor

nagisa commented May 20, 2015

I believe none of the past proposals have moved past message on IRC (and we, sadly, keep no logs).

Keep in mind, that I have no decision-making power in this project and am just stating opinion that was prevalent a few months ago; I’d reopen this for now and see what @jaspervdj has to say on here 😊

@netzwerg
Copy link
Author

Ok, l have re-opened it -- let's wait and see :-)

@netzwerg netzwerg reopened this May 20, 2015
@jaspervdj
Copy link
Owner

I think you can use $GIT_DIR and $GIT_WORK_DIR for this, but I'm open to discussion. Thanks for handling this so far @nagisa.

@cryptica
Copy link

cryptica commented Sep 2, 2016

Keeping the .git folder in the destination directory would also allow to keep it as a submodule in the gh-pages branch of the same repo (as in https://github.com/shiftyp/submodule-gh-pages-example), therefore separating source and built files while keeping easy deployment to GitHub. I don't think that works easily with $GIT_DIR and $GIT_WORK_DIR.

As for other special directories, maybe all . directories within the destination directory could be kept?

@listx
Copy link

listx commented Sep 2, 2016

FWIW, I use rsync as part of a post-build script, like this:

dest='listx.github.io/'
targ='_site/'
rsync -ahP --no-whole-file --inplace --delete --exclude=.git $targ $dest                                                                                                           
cp -f .gitignore $dest

where listx.github.io is its own git repo.

I think if we do go ahead with keeping the .git folder (or any other special folders) within _site untouched, we should make the user define all such special cases explicitly; i.e., let's not implicitly treat some particular files/paths as special.

@cryptica
Copy link

cryptica commented Sep 2, 2016

I like the idea of keeping the built files in the same repository, but on a separate branch. By including it as a submodule, there is need to call cp or rsync in a post-build script.

Adding an option to specify which directories to keep within _site would also work and be perfectly acceptable for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants