History

[ref] another test; failing for now

Sebastian Thiel committed 5 years ago

Commit 1908b691 parent bf7783d6 files · +53 −12Browse files

Showing the changes to git-ref/src (3 of 6 files). Show all

Unified · Split

3 files
  1. git-ref/src/store/file/mod.rs +1 −1
  2. git-ref/src/store/file/reference/mod.rs +14 −0
  3. git-ref/src/transaction.rs +1 −1
git-ref/src/store/file/mod.rs+1−1
@@ -20,7 +20,7 @@ impl Default for WriteReflog { · 19 unmodified lines
2020 pub struct Reference<'a> {
2121 parent: &'a Store,
2222 /// The path to uniquely identify this ref within its store.
23− pub relative_path: PathBuf,
23+ relative_path: PathBuf,
2424 state: reference::State,
2525 }
2626
git-ref/src/store/file/reference/mod.rs+14−0
@@ -1,6 +1,8 @@
1+use crate::transaction::FullName;
12 use crate::{file::Reference, Kind, Target};
23 use bstr::BString;
34 use git_hash::{oid, ObjectId};
5+use std::path::Path;
46
57 #[derive(Debug, PartialOrd, PartialEq, Ord, Eq, Hash, Clone)]
68 #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
@@ -33,6 +35,18 @@ impl<'a> Reference<'a> { · 26 unmodified lines
3335 State::Id(ref oid) => Target::Peeled(oid.as_ref()),
3436 }
3537 }
38+
39+ /// Return the full name of this reference as path
40+ pub fn relative_path(&self) -> &Path {
41+ &self.relative_path
42+ }
43+
44+ /// Return the full validated name of the reference
45+ pub fn name(&self) -> FullName {
46+ use os_str_bytes::OsStrBytes;
47+ let name = self.relative_path.as_path().to_raw_bytes();
48+ FullName(name.to_vec().into())
49+ }
3650 }
3751
3852 mod iter;
git-ref/src/transaction.rs+1−1
@@ -35,7 +35,7 @@ use std::{borrow::Cow, convert::TryFrom, path::Path}; · 34 unmodified lines
3535 /// Indicate that the given BString is a validate reference name or path that can be used as path on disk or written as target
3636 /// of a symbolic reference
3737 #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
38−pub struct FullName(BString);
38+pub struct FullName(pub(crate) BString);
3939
4040 impl TryFrom<&str> for FullName {
4141 type Error = git_validate::refname::Error;

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