Be more lenient with branch names.

Notably, the "foo@0/12345678" syntax was not allowed, because '/' is not
a word character.
This commit is contained in:
Heikki Linnakangas
2021-05-17 20:37:41 +03:00
parent 398d522d88
commit e602807476
2 changed files with 3 additions and 2 deletions

View File

@@ -697,7 +697,8 @@ impl Connection {
// branch_create <branchname> <startpoint>
// TODO lazy static
let re = Regex::new(r"^branch_create (\w+) ([\w@\\]+)[\r\n\s]*;?$").unwrap();
// TOOD: escaping, to allow branch names with spaces
let re = Regex::new(r"^branch_create (\S+) (\S+)[\r\n\s]*;?$").unwrap();
let caps = re.captures(&query_str).ok_or_else(err)?;
let branchname: String = String::from(caps.get(1).ok_or_else(err)?.as_str());