Skip to content

Commit 5d5e211

Browse files
committed
sketch API for obtaining a reflist filtered by refspecs (#450)
1 parent fd14489 commit 5d5e211

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

git-repository/src/remote/connection/list_refs.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use git_features::progress::Progress;
22
use git_protocol::transport::client::Transport;
33

4-
use crate::remote::{connection::HandshakeWithRefs, Connection, Direction};
4+
use crate::remote::{connection::HandshakeWithRefs, fetch, Connection, Direction};
55

66
mod error {
77
#[derive(Debug, thiserror::Error)]
@@ -33,6 +33,13 @@ where
3333
Ok(res.refs)
3434
}
3535

36+
/// A mapping showing the objects available in refs matching our ref-specs on the remote side, along with their destination
37+
/// ref locally, if set and if there are no conflicts.
38+
#[git_protocol::maybe_async::maybe_async]
39+
pub async fn ref_mapping(self) -> Result<Vec<fetch::Mapping>, Error> {
40+
todo!()
41+
}
42+
3643
#[git_protocol::maybe_async::maybe_async]
3744
async fn fetch_refs(&mut self) -> Result<HandshakeWithRefs, Error> {
3845
let mut credentials_storage;

git-repository/src/remote/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ pub use errors::find;
2525
///
2626
pub mod init;
2727

28+
///
29+
#[cfg(any(feature = "async-network-client", feature = "blocking-network-client"))]
30+
pub mod fetch {
31+
use crate::bstr::BString;
32+
33+
/// A mapping between a single remote reference and its advertised objects to a local destination which may or may not exist.
34+
pub struct Mapping {
35+
/// The reference on the remote side, along with information about the objects they point to as advertised by the server.
36+
pub remote: git_protocol::fetch::Ref,
37+
/// The local tracking reference to update after fetching the object visible via `remote`.
38+
pub local: Option<BString>,
39+
}
40+
}
41+
2842
///
2943
#[cfg(any(feature = "async-network-client", feature = "blocking-network-client"))]
3044
pub mod connect;

0 commit comments

Comments
 (0)