Skip to content

Commit

Permalink
Delete the submodule folder before checking out to the destination br…
Browse files Browse the repository at this point in the history
…anch to avoid the error message.
  • Loading branch information
i2000s committed Nov 1, 2017
1 parent 6e7e8e9 commit bb58ae7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ Other information if you don't understand, leaving them alone should be fine in
The publication and citation databases are defined in the `asset` directory as bibtex files with suffix `.bib`, which you may want to replace with your own.
The rest is to delete or keep posts and pages to fit into your needs.
Notice that the `assets/bibliography/refs` folder is a submodule connecting to a centralized bibliography database.
The information of the submodule can be found in the `.gitsubmodule` file under the root direction of the repo.
The information of the submodule can be found in the `.gitsubmodules` file under the root direction of the repo.
You can replace the submodule with your own bibliography repo or just use a separate `.bib` file in the `assets/bibliography` folder.
To use your own submodule, you should `git rm -rf .gitsubmodule assets/bibliography/refs` first, and then add your own submodule by `git submodule add -b YOURBibliographyBRANCH https://YOURBibliographyRemoteAddress.git assets/bibliography/refs`.
To use your own submodule, you should `git rm -rf .gitsubmodules assets/bibliography/refs` first, and then add your own submodule by `git submodule add -b YOURBibliographyBRANCH https://YOURBibliographyRemoteAddress.git assets/bibliography/refs`.
It might be also necessary to run `git submodule init` or `git submodule update` to pull your submodule files into the actual folder if it's empty.
After that, you also need to update the bibliography address in the corresponding `pandoc` bibliography extension configuration item of the `_config.yml` file.
One advantage of using the [submodule](https://git-scm.com/docs/git-submodule) feature of Git is that you can commit and push changes from this webpage repo to your bibliography repo on the specific branch and vice verse. Changes of the submodule can be committed in the corresponding submodule folder using Git the same as an independent git repo.
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ namespace :site do

sh "git checkout #{SOURCE_BRANCH}"
Dir.chdir(EXTERNAL) do
sh "git checkout #{DESTINATION_BRANCH}"
if SUBMODULEDIR
sh "rm -rf #{SUBMODULEDIR}/.git" # This is to delete the git file in the submodule folder so that the useful files there won't be recognized as submodule for the destination branch.
sh "rm -rf #{SUBMODULEDIR}" # This is to delete the git file in the submodule folder so that git won't complain when switching to the destination branch where the folder is not a submodule.
end
sh "git checkout #{DESTINATION_BRANCH}"
end

# Generate the site
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ scholar:


## Bibliography Submodule directory
submodule_directory: assets/bibliography/refs # This is used for pulling the external bibliography repo. Only one submodule is allowed for now.
submodule_directory: assets/bibliography/refs # This is used for pulling the external bibliography repo.

## Markdown Parser
markdown: pandoc
Expand Down

0 comments on commit bb58ae7

Please sign in to comment.