Skip to content

Commit ffefe88

Browse files
committed
adjust to changes in git-protocol (#450)
1 parent bc9c780 commit ffefe88

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

gitoxide-core/src/pack/receive.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ fn write_raw_refs(refs: &[Ref], directory: PathBuf) -> std::io::Result<()> {
319319
};
320320
for r in refs {
321321
let (path, content) = match r {
322+
Ref::Unborn { target } => (
323+
assure_dir_exists(&"HEAD".to_owned().into())?,
324+
format!("unborn HEAD: {}", target),
325+
),
322326
Ref::Symbolic {
323327
full_ref_name: path,
324328
target,

gitoxide-core/src/repository/remote.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ mod refs_impl {
216216
path: String,
217217
object: String,
218218
},
219+
Unborn {
220+
path: String,
221+
target: String,
222+
},
219223
Symbolic {
220224
path: String,
221225
target: String,
@@ -226,6 +230,10 @@ mod refs_impl {
226230
impl From<fetch::Ref> for JsonRef {
227231
fn from(value: fetch::Ref) -> Self {
228232
match value {
233+
fetch::Ref::Unborn { target } => JsonRef::Unborn {
234+
path: "HEAD".into(),
235+
target: target.to_string(),
236+
},
229237
fetch::Ref::Direct {
230238
full_ref_name: path,
231239
object,
@@ -271,6 +279,10 @@ mod refs_impl {
271279
target,
272280
object,
273281
} => write!(&mut out, "{} {} symref-target:{}", object, path, target).map(|_| object.as_ref()),
282+
fetch::Ref::Unborn { target } => {
283+
static NULL: git::hash::ObjectId = git::hash::ObjectId::null(git::hash::Kind::Sha1);
284+
write!(&mut out, "unborn HEAD symref-target:{}", target).map(|_| NULL.as_ref())
285+
}
274286
}
275287
}
276288

0 commit comments

Comments
 (0)