Skip to content

Commit

Permalink
xpadneo: Add documentation about testing pull requests
Browse files Browse the repository at this point in the history
Forks used for pull requests should not have tags. This is a problem
for our installer. To properly work with forks, these should be added
as a git remote instead. To still get the benefits of isolated
directories, git worktrees can be used instead.

Place a hint in the installer if this problem may occur, and also add
some documentation on how to use these features of git.

Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Dec 19, 2024
1 parent 875d5aa commit 788f004
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Testing and Development

### Working with Pull Requests

If working with pull requests, do not clone a fork of the other repository.
The installer needs the original version tags to properly work and to have
correct version tags that have not been tampered with.

It is always recommended to add additional remotes for the forks to your
already existing local clone.

To do this, follow these steps. This example uses kakra/xpadneo as a fork:
```bash
# checkout a clone from the original repository
git clone https://github.com/atar-axis/xpadneo.git
cd xpadneo

# add the fork for the pull request as a clone
git remote add kakra https://github.com/kakra/xpadneo.git
git remote update

# option 1: switch to another branch within this directory
git switch -C local/branch/name kakra/remote/branch/name

# option 2: setup a git workdir to use an isolated directory
git worktree add ../xpadneo-kakra -B local/branch/name kakra/remote/branch/name

# to update to the latest version of a pull request
git remote update --prune

# then reset your outdated copy of the branch
git reset --merge kakra/remote/branch/name # tries keeping your local modifications
git reset --hard kakra/remote/branch/name # discards your local modifications
```

3 changes: 3 additions & 0 deletions lib/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ __version() {
echo >&2 "ERROR: sudo git config --global --add safe.directory \$PWD"
echo >&2 "ERROR: to trust this git checkout for the root user."
echo >&2 "ERROR: See https://github.com/atar-axis/xpadneo/issues/346"
echo >&2
echo >&2 "HINT: Do not clone forks directly, add them as remotes to your"
echo >&2 "HINT: original clone. See docs/TESTING.md"
exit 3
}
}
Expand Down

0 comments on commit 788f004

Please sign in to comment.