Use head -n 1 in gitLastCommit().
This commit is contained in:
		@@ -268,13 +268,15 @@ QString GitClient::gitLastCommit(QString fileName) {
 | 
			
		||||
    if (QDir(m_customerRepository).exists()) {
 | 
			
		||||
        QString const filePath
 | 
			
		||||
            = QDir::cleanPath(m_customerRepository + QDir::separator() + fileName);
 | 
			
		||||
        QString const gitCommand = QString("git log %1 | head -n 1").arg(fileName);
 | 
			
		||||
        Command c("bash");
 | 
			
		||||
        if (c.execute(m_customerRepository, QStringList() << "-c" << gitCommand)) {
 | 
			
		||||
            QString const r = c.getCommandResult();
 | 
			
		||||
            int const idx = r.indexOf("commit ");
 | 
			
		||||
            if (idx != -1) {
 | 
			
		||||
                return r.mid(idx + 8).trimmed();
 | 
			
		||||
        if (QFile(filePath).exists()) {
 | 
			
		||||
            QString const gitCommand = QString("git log %1 | head -n 1").arg(fileName);
 | 
			
		||||
            Command c("bash");
 | 
			
		||||
            if (c.execute(m_customerRepository, QStringList() << "-c" << gitCommand)) {
 | 
			
		||||
                QString const r = c.getCommandResult();
 | 
			
		||||
                int const idx = r.indexOf("commit ");
 | 
			
		||||
                if (idx != -1) {
 | 
			
		||||
                    return r.mid(idx + 8).trimmed();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user