Skip to content

Commit 748a924

Browse files
jeckersbcgwalters
authored andcommitted
repository: open_path: include path in error context
It was not immediately obvious to me where the default repository was expected to be located. Signed-off-by: John Eckersberg <[email protected]>
1 parent 2b60683 commit 748a924

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/repository.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ impl Repository {
4747
}
4848

4949
pub fn open_path(dirfd: impl AsFd, path: impl AsRef<Path>) -> Result<Repository> {
50+
let path = path.as_ref();
51+
5052
// O_PATH isn't enough because flock()
51-
let repository = openat(dirfd, path.as_ref(), OFlags::RDONLY, Mode::empty())
52-
.context("Cannot open composefs repository")?;
53+
let repository = openat(dirfd, path, OFlags::RDONLY, Mode::empty())
54+
.with_context(|| format!("Cannot open composefs repository at {}", path.display()))?;
5355

5456
flock(&repository, FlockOperation::LockShared)
5557
.context("Cannot lock composefs repository")?;

0 commit comments

Comments
 (0)