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

@@ -173,6 +173,26 @@ QString GitPlugin::msgRepositoryLabel(const QString &repository)
tr("Repository: %1").arg(QDir::toNativeSeparators(repository));
}
// Returns a regular expression pattern with characters not allowed
// in branch and remote names.
QString GitPlugin::invalidBranchAndRemoteNamePattern()
{
return QLatin1String(
"\\s" // no whitespace
"|~" // no "~"
"|\\^" // no "^"
"|\\[" // no "["
"|\\.\\." // no ".."
"|/\\." // no slashdot
"|:" // no ":"
"|@\\{" // no "@{" sequence
"|\\\\" // no backslash
"|//" // no double slash
"|^[/-]" // no leading slash or dash
"|\"" // no quotes
);
}
const VcsBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_ID,