Skip to content

Commit

Permalink
adjust to changes in git-protocol (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 1, 2022
1 parent bc9c780 commit ffefe88
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gitoxide-core/src/pack/receive.rs
Expand Up @@ -319,6 +319,10 @@ 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::Symbolic {
full_ref_name: path,
target,
Expand Down
12 changes: 12 additions & 0 deletions gitoxide-core/src/repository/remote.rs
Expand Up @@ -216,6 +216,10 @@ mod refs_impl {
path: String,
object: String,
},
Unborn {
path: String,
target: String,
},
Symbolic {
path: String,
target: String,
Expand All @@ -226,6 +230,10 @@ mod refs_impl {
impl From<fetch::Ref> for JsonRef {
fn from(value: fetch::Ref) -> Self {
match value {
fetch::Ref::Unborn { target } => JsonRef::Unborn {
path: "HEAD".into(),
target: target.to_string(),
},
fetch::Ref::Direct {
full_ref_name: path,
object,
Expand Down Expand Up @@ -271,6 +279,10 @@ mod refs_impl {
target,
object,
} => write!(&mut out, "{} {} symref-target:{}", object, path, target).map(|_| object.as_ref()),
fetch::Ref::Unborn { 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())
}
}
}

Expand Down

0 comments on commit ffefe88

Please sign in to comment.