Git: Factor out pattern for invalid branch names

Re-use it in the follow-up commit for remote names also.

Change-Id: Ib88792a1abdc2fa8ac23c99aa7d4861728e36eec
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Andre Hartmann
2017-03-06 22:40:03 +01:00
committed by André Hartmann
parent 93299cb802
commit 57144e28da
3 changed files with 23 additions and 14 deletions

View File

@@ -25,6 +25,7 @@
#include "branchadddialog.h"
#include "ui_branchadddialog.h"
#include "gitplugin.h"
#include <utils/hostosinfo.h>
@@ -47,20 +48,7 @@ class BranchNameValidator : public QValidator
public:
BranchNameValidator(const QStringList &localBranches, QObject *parent = 0) :
QValidator(parent),
m_invalidChars(
"\\s" // no whitespace
"|~" // no "~"
"|\\^" // no "^"
"|\\[" // no "["
"|\\.\\." // no ".."
"|/\\." // no slashdot
"|:" // no ":"
"|@\\{" // no "@{" sequence
"|\\\\" // no backslash
"|//" // no double slash
"|^[/-]" // no leading slash or dash
"|\"" // no quotes
),
m_invalidChars(GitPlugin::invalidBranchAndRemoteNamePattern()),
m_localBranches(localBranches)
{
}