Unified · Split
| @@ -3,6 +3,8 @@ impl crate::Repository { · 2 unmodified lines | |||
| 3 | /// Return the integer value at `key` (like `core.abbrev`) or use the given `default` value if it isn't present. | 3 | /// Return the integer value at `key` (like `core.abbrev`) or use the given `default` value if it isn't present. |
| 4 | // TODO: figure out how to identify sub-sections, or how to design such an API. This is really just a first test. | 4 | // TODO: figure out how to identify sub-sections, or how to design such an API. This is really just a first test. |
| 5 | // TODO: tests | 5 | // TODO: tests |
| 6 | // TODO: parse-errors do exist, don't dumb it down too much as to not fill in defaults for incorrect configuration. | ||
| 7 | // Fail like git does. | ||
| 6 | pub(crate) fn config_int(&self, key: &str, default: i64) -> i64 { | 8 | pub(crate) fn config_int(&self, key: &str, default: i64) -> i64 { |
| 7 | let (section, key) = key.split_once('.').expect("valid section.key format"); | 9 | let (section, key) = key.split_once('.').expect("valid section.key format"); |
| 8 | self.config | 10 | self.config |
| @@ -44,7 +44,7 @@ mod find { · 43 unmodified lines | |||
| 44 | mod tag { | 44 | mod tag { |
| 45 | #[test] | 45 | #[test] |
| 46 | fn simple() -> crate::Result { | 46 | fn simple() -> crate::Result { |
| 47 | let (repo, _keep) = crate::easy_repo_rw("make_basic_repo.sh")?; | 47 | let (repo, _keep) = crate::repo_rw("make_basic_repo.sh")?; |
| 48 | let current_head_id = repo.head()?.peeled()?.id().expect("born"); | 48 | let current_head_id = repo.head()?.peeled()?.id().expect("born"); |
| 49 | let message = "a multi\nline message"; | 49 | let message = "a multi\nline message"; |
| 50 | let tag_ref = repo.tag( | 50 | let tag_ref = repo.tag( |
| @@ -16,16 +16,12 @@ fn repo_rw(name: &str) -> crate::Result<(git_repository::Repository, tempfile::T · 15 unmodified lines | |||
| 16 | )) | 16 | )) |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn easy_repo_rw(name: &str) -> crate::Result<(Repository, tempfile::TempDir)> { | ||
| 20 | repo_rw(name).map(|(repo, dir)| (repo.into(), dir)) | ||
| 21 | } | ||
| 22 | |||
| 23 | fn basic_repo() -> crate::Result<Repository> { | 19 | fn basic_repo() -> crate::Result<Repository> { |
| 24 | repo("make_basic_repo.sh").map(|r| r.to_thread_local()) | 20 | repo("make_basic_repo.sh").map(|r| r.to_thread_local()) |
| 25 | } | 21 | } |
| 26 | 22 | ||
| 27 | fn basic_rw_repo() -> crate::Result<(Repository, tempfile::TempDir)> { | 23 | fn basic_rw_repo() -> crate::Result<(Repository, tempfile::TempDir)> { |
| 28 | easy_repo_rw("make_basic_repo.sh") | 24 | repo_rw("make_basic_repo.sh") |
| 29 | } | 25 | } |
| 30 | 26 | ||
| 31 | mod discover; | 27 | mod discover; |