From bb58ae70079ec9525cec5832af11e8a518683685 Mon Sep 17 00:00:00 2001 From: Qi Date: Wed, 1 Nov 2017 01:06:18 -0600 Subject: [PATCH] Delete the submodule folder before checking out to the destination branch to avoid the error message. --- README.md | 4 ++-- Rakefile | 4 ++-- _config.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5e34c6be3..670db78bf 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Rakefile b/Rakefile index be74044a6..cd2150da5 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/_config.yml b/_config.yml index 694576297..82635004f 100644 --- a/_config.yml +++ b/_config.yml @@ -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