Skip to content

Commit

Permalink
Allow short oid resolution to resolve any object
Browse files Browse the repository at this point in the history
  • Loading branch information
slarse committed Nov 12, 2023
1 parent 04d32ac commit a404072
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use regex::Regex;

use crate::file;
use crate::hex;
use crate::objects::{GitObject, ObjectId};
use crate::objects::ObjectId;
use crate::workspace::Repository;

pub struct RefHandler<'a> {
Expand Down Expand Up @@ -47,7 +47,7 @@ impl<'a> RefHandler<'a> {
} else if ref_file.is_file() {
fs::read_to_string(&ref_file).map(|content| content.trim().to_owned())?
} else if let Some(oid) = self.repository.database.prefix_match(reference) {
self.repository.database.load_commit(&oid)?.id().to_string()
oid.to_string()
} else {
let message = format!("Could not dereference ref {}", reference);
return Err(crate::Error::Fatal(None, message));
Expand Down

0 comments on commit a404072

Please sign in to comment.