History

frame for simplified config access via Repository (#298)

Sebastian Thiel committed 4 years ago

Commit eba2b9a1 parent 76201865 files · +25 −2Browse files

Unified · Split

5 files
  1. git-repository/src/id.rs +1 −1
  2. git-repository/src/lib.rs +12 −0
  3. git-repository/src/open.rs +1 −1
  4. git-repository/src/repository/config.rs +9 −0
  5. git-repository/src/repository/mod.rs +2 −0
git-repository/src/id.rs+1−1
@@ -47,7 +47,7 @@ mod prefix { · 46 unmodified lines
47 #[error(transparent)]47 #[error(transparent)]
48 FindExisting(#[from] crate::object::find::existing::OdbError),48 FindExisting(#[from] crate::object::find::existing::OdbError),
49 #[error(transparent)]49 #[error(transparent)]
50 Config(#[from] git_config::parser::ParserOrIoError<'static>),50 Config(#[from] crate::config::open::Error),
51 #[error(transparent)]51 #[error(transparent)]
52 Prefix(#[from] git_hash::prefix::Error),52 Prefix(#[from] git_hash::prefix::Error),
53 }53 }
git-repository/src/lib.rs+12−0
@@ -228,6 +228,18 @@ pub fn open(directory: impl Into<std::path::PathBuf>) -> Result<crate::Repositor · 227 unmodified lines
228///228///
229pub mod open;229pub mod open;
230 230
231///
232mod config {
233 ///
234 pub mod open {
235 pub type Error = git_config::parser::ParserOrIoError<'static>;
236 }
237 ///
238 pub mod query {
239 pub type Error = git_config::file::GitConfigError<'static>;
240 }
241}
242
231///243///
232pub mod init {244pub mod init {
233 use std::{convert::TryInto, path::Path};245 use std::{convert::TryInto, path::Path};
git-repository/src/open.rs+1−1
@@ -31,7 +31,7 @@ impl Options { · 30 unmodified lines
31#[allow(missing_docs)]31#[allow(missing_docs)]
32pub enum Error {32pub enum Error {
33 #[error(transparent)]33 #[error(transparent)]
34 Config(#[from] git_config::parser::ParserOrIoError<'static>),34 Config(#[from] crate::config::open::Error),
35 #[error(transparent)]35 #[error(transparent)]
36 NotARepository(#[from] crate::path::is::Error),36 NotARepository(#[from] crate::path::is::Error),
37 #[error(transparent)]37 #[error(transparent)]
git-repository/src/repository/config.rs+9−0
@@ -0,0 +1,9 @@
1use crate::config;
2
3/// Provide simplified access to git configuration values
4impl crate::Repository {
5 /// Return the integer value at `key` (like `core.abbrev`) or use the given `default` value if it isn't present.
6 pub fn config_int(_key: &str, _default: i64) -> Result<i64, config::query::Error> {
7 todo!()
8 }
9}
git-repository/src/repository/mod.rs+2−0
@@ -82,6 +82,8 @@ mod trait_impls; · 81 unmodified lines
82 82
83mod cache;83mod cache;
84 84
85mod config;
86
85mod reference;87mod reference;
86 88
87mod object;89mod object;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t