[PATCH] Fix regular expressions for git repositories
Dirk Hohndel
dirk at hohndel.org
Mon Aug 10 00:01:37 PDT 2015
I would like to see some testing of this. IIRC you do NOT want to escale
the next character after a '^' as first character in a character class.
I'm reasonably certain that I tested the existing code and that it works -
I'm ok being proven wrong, but I'd like to make sure that this is at least
tested and not submitted as "I didn't test it but the original code looked
wrong" :-)
So right now the patch is NAK. Feel free to resubmit with a commit message
that includes a truthful statement "I tested this and the old one breaks
on THIS input and that works after applying this patch"...
Thanks
/D
On Fri, Aug 07, 2015 at 07:22:27PM +0300, Miika Turkia wrote:
> Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> ---
> This is something I have not tested at all, but it caught my eye when I
> was looking at the patch breaking the file opening dialog (#913). The
> original code just screams it needs more escaping of the angle brackets.
> ---
> qt-ui/mainwindow.cpp | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
> index db1d8c8..dedd2ce 100644
> --- a/qt-ui/mainwindow.cpp
> +++ b/qt-ui/mainwindow.cpp
> @@ -319,7 +319,7 @@ void MainWindow::on_actionOpen_triggered()
> // so we would get dir[branch].ssrf when trying to select dir[branch].
> // let's detect that and remove the incorrect extension
> QStringList cleanFilenames;
> - QRegularExpression reg(".*\\[[^]]+]\\.ssrf", QRegularExpression::CaseInsensitiveOption);
> + QRegularExpression reg(".*\\[[^\\]]+\\]\\.ssrf", QRegularExpression::CaseInsensitiveOption);
>
> Q_FOREACH (QString filename, filenames) {
> if (reg.match(filename).hasMatch())
> @@ -1369,7 +1369,7 @@ int MainWindow::file_save_as(void)
> /* now for reasons I don't understand we appear to add a .ssrf to
> * git style filenames <path>/directory[branch]
> * so let's remove that */
> - QRegularExpression reg(".*\\[[^]]+]\\.ssrf", QRegularExpression::CaseInsensitiveOption);
> + QRegularExpression reg(".*\\[[^\\]]+\\]\\.ssrf", QRegularExpression::CaseInsensitiveOption);
> if (reg.match(filename).hasMatch())
> filename.remove(QRegularExpression("\\.ssrf$", QRegularExpression::CaseInsensitiveOption));
> if (filename.isNull() || filename.isEmpty())
> --
> 2.1.4
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface
mailing list