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
20pub struct Reference<'a> {20pub struct Reference<'a> {
21 parent: &'a Store,21 parent: &'a Store,
22 /// The path to uniquely identify this ref within its store.22 /// The path to uniquely identify this ref within its store.
23 pub relative_path: PathBuf,23 relative_path: PathBuf,
24 state: reference::State,24 state: reference::State,
25}25}
26 26
git-ref/src/store/file/reference/mod.rs+14−0
@@ -1,6 +1,8 @@
1use crate::transaction::FullName;
1use crate::{file::Reference, Kind, Target};2use crate::{file::Reference, Kind, Target};
2use bstr::BString;3use bstr::BString;
3use git_hash::{oid, ObjectId};4use git_hash::{oid, ObjectId};
5use std::path::Path;
4 6
5#[derive(Debug, PartialOrd, PartialEq, Ord, Eq, Hash, Clone)]7#[derive(Debug, PartialOrd, PartialEq, Ord, Eq, Hash, Clone)]
6#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]8#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
@@ -33,6 +35,18 @@ impl<'a> Reference<'a> { · 26 unmodified lines
33 State::Id(ref oid) => Target::Peeled(oid.as_ref()),35 State::Id(ref oid) => Target::Peeled(oid.as_ref()),
34 }36 }
35 }37 }
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 }
36}50}
37 51
38mod iter;52mod iter;
git-ref/src/transaction.rs+1−1
@@ -35,7 +35,7 @@ use std::{borrow::Cow, convert::TryFrom, path::Path}; · 34 unmodified lines
35/// Indicate that the given BString is a validate reference name or path that can be used as path on disk or written as target35/// Indicate that the given BString is a validate reference name or path that can be used as path on disk or written as target
36/// of a symbolic reference36/// of a symbolic reference
37#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]37#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
38pub struct FullName(BString);38pub struct FullName(pub(crate) BString);
39 39
40impl TryFrom<&str> for FullName {40impl TryFrom<&str> for FullName {
41 type Error = git_validate::refname::Error;41 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