Open andrewhu-uw opened 5 years ago
@andrewhu-uw are you still facing this issue?
Not the original author, but I observed the same behavior. Specifically it seems that mdbooks copies the .git
directory when src = "."
. Deleting the copied .git
in the build folder allows to rebuild. However, then again the .git folder is re-created in the build folder has to be manually deleted.
This issues seems to only occur after the first commit. On a freshly initialized repo without a single commit, I could not reproduce the issue. After doing the first commit I observed the described behavior.
I have added a minimal failing example in the details below.
Okay it seems the issue pops up in src/renderer/html_handlebars/hbs_renderer.rs
:
// Copy all remaining files, avoid a recursive copy from/to the book build dir
utils::fs::copy_files_except_ext(&src_dir, &destination, true, Some(&build_dir), &["md"])?;
That also explains, why you can just rerun with the subdir without deleting the .git dir. It will simply not attempt to copy it, hence there is no issue.
I'm happy to contribute a fix for this issue. However, I guess there are mutliple ways to go about it:
.git
directories [".git"]
Any preference how to fix this issue?
Edit: I implemented Option 2 here: https://github.com/chmp/mdBook/tree/feature/html-exclude
I was trying to get mdbook to output the HTML in the root of my git repository by setting
in my
book.toml
. However, when I ranmdbook build
I got this errorThen, when I went to check
git status
I gotNow, I know the build command is supposed to erase everything in the build-dir, which was pointed out in #436 but in this case, you can't just go
git reset --hard
since it breaks the git repo.Now, on Linux it works "as intended" and erases all of the source files and the
.git
folder