Skip to content

Commit 09948a5

Browse files
author
Sidney Douw
committed
use rev_parse_single() instead of rev_parse().single()
1 parent 9491528 commit 09948a5

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

git-repository/tests/reference/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mod find {
7070
fn set_target_id() {
7171
let (repo, _tmp) = repo_rw("make_basic_repo.sh").unwrap();
7272
let mut head_ref = repo.head_ref().unwrap().expect("present");
73-
let target_id = repo.rev_parse(":/c1").unwrap().single().unwrap();
73+
let target_id = repo.rev_parse_single(":/c1").unwrap();
7474
let prev_id = head_ref.id();
7575
assert_ne!(prev_id, target_id, "we don't point to the target id yet");
7676
head_ref.set_target_id(target_id, "reflog message").unwrap();

gitoxide-core/src/repository/commit.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ pub fn describe(
1818
) -> Result<()> {
1919
repo.object_cache_size_if_unset(4 * 1024 * 1024);
2020
let commit = match rev_spec {
21-
Some(spec) => repo
22-
.rev_parse(spec)?
23-
.single()
24-
.context("Need single revision revspec")?
25-
.object()?
26-
.try_into_commit()?,
21+
Some(spec) => repo.rev_parse_single(spec)?.object()?.try_into_commit()?,
2722
None => repo.head_commit()?,
2823
};
2924
use git::commit::describe::SelectRef::*;

gitoxide-core/src/repository/revision/list.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ pub fn list(
1818

1919
let spec = git::path::os_str_into_bstr(&spec)?;
2020
let id = repo
21-
.rev_parse(spec)?
22-
.single()
21+
.rev_parse_single(spec)
2322
.context("Only single revisions are currently supported")?;
2423
let commit_id = id
2524
.object()?

0 commit comments

Comments
 (0)