4ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5REPO_DIR="$ASSET_DIR/.."
7# Ensure submodules are initialized.
10 local submodule_prompt=unspecified
14 while { read -r submodule && read -r submodule_path; } <&3; do
15 if ! [[ -d "${REPO_DIR}/.git/modules/${submodule}" ]] && [[ -d "${REPO_DIR}/${submodule_path}" ]]; then
16 if [[ "$submodule_prompt" = "unspecified" ]]; then
17 echo "One or more submodules were found to be uninitialized."
18 printf "Initialize and update them? [Y/n] "
19 read -r submodule_prompt
22 case "$submodule_prompt" in
24 git -C "$REPO_DIR" submodule update --init "$submodule_path"
30 echo "Unknown answer. Not updating submodules."
35 } 3< <(git config --file "${REPO_DIR}/.gitmodules" --null --get-regexp path | xargs -0 printf "%s\n" | sed 's/^submodule.//;s/.path$//')
42# Always remove the local cache to avoid any confusion
46# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
47# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
52 for patch in patches/*.patch; do
53 patch --strip=0 < "$patch"
60 for patch in patches/*.patch; do
61 patch --strip=0 --reverse <"$patch"
66# Make sure to always reverse patches, even if the `bat cache` command fails or aborts
67trap reverse_patches EXIT
69bat cache --build --blank --acknowledgements --source="$ASSET_DIR" --target="$ASSET_DIR"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list