Skip to content

Commit e77754e

Browse files
committed
fix: partial_ref_name
The previous commit was a bit overzealous in combining error conditions in partial_ref_name().
1 parent f4e18de commit e77754e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wrap/partialrefname.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ pub(crate) fn partial_ref_name(input: &mut &str) -> ModalResult<PartialRefName>
101101

102102
let name = input.next_slice(split_offset);
103103

104-
if name.is_empty() || name == "-" || name.ends_with(".lock") {
104+
if name.is_empty() || name == "-" {
105+
Err(ErrMode::Backtrack(ContextError::from_input(input)))
106+
} else if name.ends_with(".lock") {
105107
// Names ending with ".lock" are invalid and there is no recovery.
106108
Err(ErrMode::Cut(ContextError::from_input(input)))
107109
} else {

0 commit comments

Comments
 (0)