Skip to content

Commit

Permalink
use git-quote crate in git-odb alternate parsing (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Mar 24, 2022
1 parent 1be8f14 commit 8e49aa6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 139 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion git-odb/Cargo.toml
Expand Up @@ -32,11 +32,11 @@ all-features = true
[dependencies]
git-features = { version = "^0.19.1", path = "../git-features", features = ["rustsha1", "walkdir", "zlib", "crc32", "bstr"] }
git-hash = { version = "^0.9.2", path = "../git-hash" }
git-quote = { version = "^0.1.0", path = "../git-quote" }
git-object = { version = "^0.17.1", path = "../git-object" }
git-pack = { version = "^0.17.0", path = "../git-pack" }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}

btoi = "0.4.2"
tempfile = "3.1.0"
thiserror = "1.0.26"
parking_lot = { version = "0.12.0" }
Expand Down
2 changes: 0 additions & 2 deletions git-odb/src/alternate/mod.rs
Expand Up @@ -20,8 +20,6 @@ use std::{fs, io, path::PathBuf};

///
pub mod parse;
///
pub mod unquote;

/// Returned by [`resolve()`]
#[derive(thiserror::Error, Debug)]
Expand Down
6 changes: 2 additions & 4 deletions git-odb/src/alternate/parse.rs
Expand Up @@ -2,16 +2,14 @@ use std::{borrow::Cow, path::PathBuf};

use git_object::bstr::ByteSlice;

use crate::alternate::unquote;

/// Returned as part of [`crate::alternate::Error::Parse`]
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub enum Error {
#[error("Could not obtain an object path for the alternate directory '{}'", String::from_utf8_lossy(.0))]
PathConversion(Vec<u8>),
#[error("Could not unquote alternate path")]
Unquote(#[from] unquote::Error),
Unquote(#[from] git_quote::ansi_c::undo::Error),
}

pub(crate) fn content(input: &[u8]) -> Result<Vec<PathBuf>, Error> {
Expand All @@ -23,7 +21,7 @@ pub(crate) fn content(input: &[u8]) -> Result<Vec<PathBuf>, Error> {
}
out.push(
git_features::path::from_bstr(if line.starts_with(b"\"") {
unquote::ansi_c(line)?
git_quote::ansi_c::undo(line)?
} else {
Cow::Borrowed(line)
})
Expand Down
129 changes: 0 additions & 129 deletions git-odb/src/alternate/unquote.rs

This file was deleted.

2 changes: 1 addition & 1 deletion git-quote/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "git-quote"
version = "0.0.0"
version = "0.1.0"
repository = "https://github.com/Byron/gitoxide"
license = "MIT/Apache-2.0"
description = "A WIP crate of the gitoxide project dealing with various quotations used by git"
Expand Down

0 comments on commit 8e49aa6

Please sign in to comment.