Docs on alternative steps to clone the repo (#12107)

This commit is contained in:
kasperskier 2022-06-07 18:12:45 +08:00 committed by GitHub
parent 45d6042c81
commit c0b0be97ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 64 additions and 0 deletions

View File

@ -8,6 +8,7 @@ This guide is not definitive and it's being updated over time. If you find any i
1. [Prerequisites](#prerequisites)
1. [Tools](#tools)
2. [Cloning the repository](#cloning-the-repository)
2. [Getting help](#getting-help)
3. [Writing an extension](#writing-an-extension)
1. [Setting up a new Gradle module](#setting-up-a-new-gradle-module)
@ -49,6 +50,69 @@ Before you start, please note that the ability to use following technologies is
- Emulator or phone with developer options enabled and a recent version of Tachiyomi installed
- [Icon Generator](https://as280093.github.io/AndroidAssetStudio/icons-launcher.html)
### Cloning the repository
Some alternative steps can be followed to ignore "repo" branch and skip unrelated sources, which will make it faster to pull, navigate and build. This will also reduce disk usage and network traffic.
<details><summary>Steps</summary>
1. Make sure to delete "repo" branch in your fork.
2. Do a partial clone.
```bash
git clone --filter=blob:none --no-checkout <fork-repo-url>
cd tachiyomi-extensions/
```
3. Configure sparse checkout.
```bash
# enable sparse checkout
git sparse-checkout set
# edit sparse checkout filter
vim .git/info/sparse-checkout
# alternatively, if you have VS Code installed
code .git/info/sparse-checkout
```
Here's an example:
```bash
/*
!/src/*
!/multisrc/overrides/*
!/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/*
# allow a single source
/src/<lang>/<source>
# allow a multisrc theme
/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/<source>
/multisrc/overrides/<source>
```
4. Configure remotes.
```bash
# add upstream
git remote add upstream <tachiyomiorg-repo-url>
# optionally disable push to upstream
git remote set-url --push upstream no_pushing
# ignore 'repo' branch of upstream
# option 1: use negative refspec
git config --add remote.upstream.fetch "^refs/heads/repo"
# option 2: fetch master only (ignore all other branches)
git config remote.upstream.fetch "+refs/heads/master:refs/remotes/upstream/master"
# update remotes
git remote update
# track master of upstream instead of fork
git branch master -u upstream/master
# checkout
git switch master
```
5. Useful configurations. (optional)
```bash
# prune obsolete remote branches on fetch
git config remote.origin.prune true
# fast-forward only when pulling master branch
git config pull.ff only
```
6. Later, if you change the sparse checkout filter, run `git sparse-checkout reapply`.
Read more on [partial clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/), [sparse checkout](https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/) and [negative refspecs](https://github.blog/2020-10-19-git-2-29-released/#user-content-negative-refspecs).
</details>
## Getting help
- Join [the Discord server](https://discord.gg/tachiyomi) for online help and to ask questions while developing your extension. When doing so, please ask it in the `#programming` channel.