diff --git a/gitoxide-core/src/pack/receive.rs b/gitoxide-core/src/pack/receive.rs index 2e8fc460a7..869a6a98ea 100644 --- a/gitoxide-core/src/pack/receive.rs +++ b/gitoxide-core/src/pack/receive.rs @@ -321,10 +321,9 @@ fn write_raw_refs(refs: &[Ref], directory: PathBuf) -> std::io::Result<()> { }; for r in refs { let (path, content) = match r { - Ref::Unborn { target } => ( - assure_dir_exists(&"HEAD".to_owned().into())?, - format!("unborn HEAD: {}", target), - ), + Ref::Unborn { full_ref_name, target } => { + (assure_dir_exists(full_ref_name)?, format!("unborn HEAD: {}", target)) + } Ref::Symbolic { full_ref_name: path, target, diff --git a/gitoxide-core/src/repository/remote.rs b/gitoxide-core/src/repository/remote.rs index b77a27ba1e..227deeee73 100644 --- a/gitoxide-core/src/repository/remote.rs +++ b/gitoxide-core/src/repository/remote.rs @@ -230,8 +230,8 @@ mod refs_impl { impl From for JsonRef { fn from(value: fetch::Ref) -> Self { match value { - fetch::Ref::Unborn { target } => JsonRef::Unborn { - path: "HEAD".into(), + fetch::Ref::Unborn { full_ref_name, target } => JsonRef::Unborn { + path: full_ref_name.to_string(), target: target.to_string(), }, fetch::Ref::Direct { @@ -279,9 +279,9 @@ mod refs_impl { target, object, } => write!(&mut out, "{} {} symref-target:{}", object, path, target).map(|_| object.as_ref()), - fetch::Ref::Unborn { target } => { + fetch::Ref::Unborn { full_ref_name, target } => { static NULL: git::hash::ObjectId = git::hash::ObjectId::null(git::hash::Kind::Sha1); - write!(&mut out, "unborn HEAD symref-target:{}", target).map(|_| NULL.as_ref()) + write!(&mut out, "unborn {} symref-target:{}", full_ref_name, target).map(|_| NULL.as_ref()) } } }