Restore thesis.bcf from git commit if modified in workspace

This is a convenience to avoid having to remember to restore
this file after any broken compiles.
master
Taha Ahmed 1 year ago
parent 5a73e3e49d
commit 205c8a8afe

@ -191,6 +191,20 @@ if [[ $show_menu == "false" ]]; then
#### Special treatment for thesis
if [[ $path_wd == "$path_thesis" && $jobname == "$dir_wd" ]]; then
# Restore thesis.bcf from latest commit if modified in workspace
# Background: any LaTeX run that finishes uncleanly (due to errors, etc.) leaves
# the bcf file in an incomplete state. Since we have at least one plot in the thesis
# that reads the bcf file, this in turn causes the subsequent chertex compilation
# to fail. This mess could be automatically avoided if we pre-emptively check
# if thesis.bcf is listed in the output of `git status --short`, and if so `git restore` it.
# https://stackoverflow.com/a/25149786/1198249
if [[ `git status --porcelain | grep $jobname.bcf` ]]; then
msg "<thesis> -------------------------------"
msg "<thesis> Restoring thesis.bcf"
msg "<thesis> -------------------------------"
git -C $path_wd restore $jobname.bcf
simpledelay.sh 2
fi
# Fetch external assets by reading any assets.external files in assets/ tree
# NOTE: be careful NOT to leave empty lines in your assets.external files
msg "<thesis> -------------------------------"

Loading…
Cancel
Save