Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
radicle: fix divergence check
Browse files Browse the repository at this point in the history
The `graph_descendant_of` method is strict in that it will return
false if the two `Oid`s are equal -- they are strictly not
descendants.

If the `head` is the same as the `canonical_oid`, no error should be
returned and the `push` can happen without any issues.

Add a check for `head != canonical_oid` before the
`graph_descendant_check`.

Signed-off-by: Fintan Halpenny <[email protected]>
X-Clacks-Overhead: GNU Terry Pratchett
  • Loading branch information
FintanH committed Oct 5, 2023
1 parent cd4c449 commit 499738d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion radicle-remote-helper/src/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ pub fn run(
let head = working.find_reference(src.as_str())?;
let head = head.peel_to_commit()?.id();

if !working.graph_descendant_of(head, **canonical_oid)? {
if head != **canonical_oid
&& !working.graph_descendant_of(head, **canonical_oid)?
{
eprintln!(
"hint: you are attempting to push a commit that would \
cause your upstream to diverge from the canonical head"
Expand Down

0 comments on commit 499738d

Please sign in to comment.