This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: Write test for merge commits with patches
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Let's test that merge commits are handled properly in the context of patches. | ||
First, let's create a patch. | ||
``` (stderr) RAD_SOCKET=/dev/null | ||
$ git checkout -b feature/1 -q | ||
$ git commit --allow-empty -q -m "First change" | ||
$ git push rad HEAD:refs/patches | ||
✓ Patch 143bb0c962561b09e86478a53ba346b5ff934335 opened | ||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi | ||
* [new reference] HEAD -> refs/patches | ||
``` | ||
|
||
Then let's update the master branch so that merging the patch would create a merge commit. | ||
``` | ||
$ git checkout master -q | ||
$ git commit --amend --allow-empty -q -m "Concurrent change" | ||
$ git rev-parse HEAD | ||
f65977beef04fcc5cd5395feed7ff4c37cd90a2f | ||
``` | ||
|
||
Now let's merge the patch, creating a merge commit. We can see that one of the | ||
parents is the patch head. | ||
``` | ||
$ git merge feature/1 -q --no-ff | ||
$ git show --format=raw HEAD | ||
commit 737a10cfa29111afeb0d43cf3545cee386b939ec | ||
tree b4eecafa9be2f2006ce1b709d6857b07069b4608 | ||
parent f65977beef04fcc5cd5395feed7ff4c37cd90a2f | ||
parent 20aa5dde6210796c3a2f04079b42316a31d02689 | ||
author radicle <radicle@localhost> 1671125284 +0000 | ||
committer radicle <radicle@localhost> 1671125284 +0000 | ||
Merge branch 'feature/1' | ||
``` | ||
|
||
Finally, we push master and expect the patch to be merged. | ||
``` (stderr) RAD_SOCKET=/dev/null | ||
$ git push rad master | ||
✓ Patch 143bb0c962561b09e86478a53ba346b5ff934335 merged | ||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi | ||
f2de534..737a10c master -> master | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters