From 685c87fcac2bf3b1ed094df31c8efc74011a8254 Mon Sep 17 00:00:00 2001 From: ste Date: Sun, 3 Mar 2024 14:19:57 +0100 Subject: [PATCH] Remove double dashes and underscores in branch names --- src/repo.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/repo.rs b/src/repo.rs index cd71a5f..5d7e38a 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -119,9 +119,17 @@ impl Repository { "_", ); while branch_name.contains("..") { - // .... -> .. -> . + // ... -> .. -> . branch_name = branch_name.replace("..", "."); } + while branch_name.contains("__") { + // ___ -> __ -> _ + branch_name = branch_name.replace("__", "_"); + } + while branch_name.contains("--") { + // --- -> -- -> - + branch_name = branch_name.replace("--", "-"); + } while branch_name.contains("${") { // $${{ -> $( -> branch_name = branch_name.replace("${", "");