VCS: Refactor fileNameFromDiffSpecification

Use diff file pattern to match file name. Avoid duplication.

Include unit tests for Git

Change-Id: Ib68a08368270a27976a3e16bdd1cb219a52b8889
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-01-19 23:19:38 +02:00
committed by Orgad Shaneh
parent 57ee50d52f
commit 7b39f41c05
26 changed files with 256 additions and 244 deletions

View File

@@ -116,7 +116,7 @@ DiffFormats DiffHighlighterPrivate::analyzeLine(const QString &text) const
{
// Do not match on git "--- a/" as a deleted line, check
// file first
if (m_filePattern.exactMatch(text))
if (m_filePattern.indexIn(text) == 0)
return DiffFileFormat;
if (text.startsWith(m_diffInIndicator))
return DiffInFormat;