diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs
index ccf5c44092db24a6391d6f5bf3bb82872b9ad9eb_cnVzdC9oZy1jb3JlL3NyYy9hbmNlc3RvcnMucnM=..b08c5fbe0e70a56f761bec76ef2ae3018d36fef6_cnVzdC9oZy1jb3JlL3NyYy9hbmNlc3RvcnMucnM= 100644
--- a/rust/hg-core/src/ancestors.rs
+++ b/rust/hg-core/src/ancestors.rs
@@ -423,6 +423,18 @@
             ),
             vec![8, 7, 4, 3, 2, 1, 0]
         );
+        // it works as well on references, because &Graph implements Graph
+        // this is needed as of this writing by RHGitaly
+        assert_eq!(
+            list_ancestors(
+                &SampleGraph,
+                vec![11.into(), 13.into()],
+                0.into(),
+                false
+            ),
+            vec![8, 7, 4, 3, 2, 1, 0]
+        );
+
         assert_eq!(
             list_ancestors(
                 SampleGraph,
diff --git a/rust/hg-core/src/revlog/mod.rs b/rust/hg-core/src/revlog/mod.rs
index ccf5c44092db24a6391d6f5bf3bb82872b9ad9eb_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvbW9kLnJz..b08c5fbe0e70a56f761bec76ef2ae3018d36fef6_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvbW9kLnJz 100644
--- a/rust/hg-core/src/revlog/mod.rs
+++ b/rust/hg-core/src/revlog/mod.rs
@@ -132,6 +132,12 @@
     ParentOutOfRange(Revision),
 }
 
+impl<T: Graph> Graph for &T {
+    fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {
+        (*self).parents(rev)
+    }
+}
+
 /// The Mercurial Revlog Index
 ///
 /// This is currently limited to the minimal interface that is needed for