Skip to content

Commit 06d45ff

Browse files
committed
adjust to changes in git-protocol (#450)
1 parent d2c772e commit 06d45ff

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

gitoxide-core/src/pack/receive.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<W> protocol::fetch::DelegateBlocking for CloneDelegate<W> {
9090
) -> io::Result<Action> {
9191
if self.wanted_refs.is_empty() {
9292
for r in refs {
93-
let (path, id) = r.unpack();
93+
let (path, id, _) = r.unpack();
9494
match self.ref_filter {
9595
Some(ref_prefixes) => {
9696
if ref_prefixes.iter().any(|prefix| path.starts_with_str(prefix)) {
@@ -310,10 +310,20 @@ fn write_raw_refs(refs: &[Ref], directory: PathBuf) -> std::io::Result<()> {
310310
};
311311
for r in refs {
312312
let (path, content) = match r {
313-
Ref::Symbolic { path, target, .. } => (assure_dir_exists(path)?, format!("ref: {}", target)),
314-
Ref::Peeled { path, tag: object, .. } | Ref::Direct { path, object } => {
315-
(assure_dir_exists(path)?, object.to_string())
313+
Ref::Symbolic {
314+
full_ref_name: path,
315+
target,
316+
..
317+
} => (assure_dir_exists(path)?, format!("ref: {}", target)),
318+
Ref::Peeled {
319+
full_ref_name: path,
320+
tag: object,
321+
..
316322
}
323+
| Ref::Direct {
324+
full_ref_name: path,
325+
object,
326+
} => (assure_dir_exists(path)?, object.to_string()),
317327
};
318328
std::fs::write(path, content.as_bytes())?;
319329
}

gitoxide-core/src/repository/remote.rs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,27 @@ mod net {
8181
impl From<fetch::Ref> for JsonRef {
8282
fn from(value: fetch::Ref) -> Self {
8383
match value {
84-
fetch::Ref::Direct { path, object } => JsonRef::Direct {
84+
fetch::Ref::Direct {
85+
full_ref_name: path,
86+
object,
87+
} => JsonRef::Direct {
8588
path: path.to_string(),
8689
object: object.to_string(),
8790
},
88-
fetch::Ref::Symbolic { path, target, object } => JsonRef::Symbolic {
91+
fetch::Ref::Symbolic {
92+
full_ref_name: path,
93+
target,
94+
object,
95+
} => JsonRef::Symbolic {
8996
path: path.to_string(),
9097
target: target.to_string(),
9198
object: object.to_string(),
9299
},
93-
fetch::Ref::Peeled { path, tag, object } => JsonRef::Peeled {
100+
fetch::Ref::Peeled {
101+
full_ref_name: path,
102+
tag,
103+
object,
104+
} => JsonRef::Peeled {
94105
path: path.to_string(),
95106
tag: tag.to_string(),
96107
object: object.to_string(),
@@ -102,11 +113,22 @@ mod net {
102113
pub(crate) fn print(mut out: impl std::io::Write, refs: &[fetch::Ref]) -> std::io::Result<()> {
103114
for r in refs {
104115
match r {
105-
fetch::Ref::Direct { path, object } => writeln!(&mut out, "{} {}", object.to_hex(), path),
106-
fetch::Ref::Peeled { path, object, tag } => {
116+
fetch::Ref::Direct {
117+
full_ref_name: path,
118+
object,
119+
} => writeln!(&mut out, "{} {}", object.to_hex(), path),
120+
fetch::Ref::Peeled {
121+
full_ref_name: path,
122+
object,
123+
tag,
124+
} => {
107125
writeln!(&mut out, "{} {} tag:{}", object.to_hex(), path, tag)
108126
}
109-
fetch::Ref::Symbolic { path, target, object } => {
127+
fetch::Ref::Symbolic {
128+
full_ref_name: path,
129+
target,
130+
object,
131+
} => {
110132
writeln!(&mut out, "{} {} symref-target:{}", object.to_hex(), path, target)
111133
}
112134
}?;

0 commit comments

Comments
 (0)