History

[git-ref] clear it out and move existing functionality to git-object

This removes an uncanny dependency. Maybe now we have it the other way around. Possibly there should be a new crate to contain shared validation code? Maybe it should just be duplicated? No, that could mean code drift. It makes sense for the functionality to be included in the crate that needs it, so lets see what kind of input validation needs to happen for refs to work and if it truly is the same. As it's pretty stable there shouldn't be too much worry about somewhat similar code to exist in various crates.

Sebastian Thiel committed 5 years ago

Commit fa548ce1 parent 251e69011 files · +77 −75Browse files

Showing the changes to git-object/src/mutable (1 of 11 files). Show all

Unified · Split

git-object/src/mutable/tag.rs+2−2
@@ -10,7 +10,7 @@ quick_error! { · 9 unmodified lines
10 StartsWithDash {10 StartsWithDash {
11 display("Tags must not start with a dash: '-'")11 display("Tags must not start with a dash: '-'")
12 }12 }
13 InvalidRefName(err: git_ref::validate::NameError) {13 InvalidRefName(err: crate::tag::validate::NameError) {
14 display("The tag name was no valid reference name")14 display("The tag name was no valid reference name")
15 from()15 from()
16 source(err)16 source(err)
@@ -65,7 +65,7 @@ impl Tag { · 48 unmodified lines
65}65}
66 66
67fn validated_name(name: &BStr) -> Result<&BStr, Error> {67fn validated_name(name: &BStr) -> Result<&BStr, Error> {
68 git_ref::validate::name(name)?;68 crate::tag::validate::name(name)?;
69 if name[0] == b'-' {69 if name[0] == b'-' {
70 return Err(Error::StartsWithDash);70 return Err(Error::StartsWithDash);
71 }71 }