Added gitShowReason(): get lastCommit, message and date of last commit to insert inti
sendLastVersion-message to ISMAS.
This commit is contained in:
		@@ -114,6 +114,47 @@ bool GitClient::gitCloneAndCheckoutBranch() {
 | 
				
			|||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QStringList GitClient::gitShowReason() {
 | 
				
			||||||
 | 
					    QStringList lst;
 | 
				
			||||||
 | 
					    if (QDir(m_customerRepository).exists()) {
 | 
				
			||||||
 | 
					        // %h: commit (short form)
 | 
				
			||||||
 | 
					        // %s: commit message
 | 
				
			||||||
 | 
					        // %cI: commit date, strict ISO 8601 format
 | 
				
			||||||
 | 
					        Command c("git show -s --format=\"c=%h m=%s d=%cI\"");
 | 
				
			||||||
 | 
					        if (c.execute(m_customerRepository)) {
 | 
				
			||||||
 | 
					            QString const s = c.getCommandResult().trimmed();
 | 
				
			||||||
 | 
					            int const c = s.indexOf("c=");
 | 
				
			||||||
 | 
					            int const m = s.indexOf("m=");
 | 
				
			||||||
 | 
					            int const d = s.indexOf("d=");
 | 
				
			||||||
 | 
					            QString commit{""}, msg{""}, date{""};
 | 
				
			||||||
 | 
					            if (c != -1) {
 | 
				
			||||||
 | 
					                int start = c + 2;
 | 
				
			||||||
 | 
					                if (m >= start) {
 | 
				
			||||||
 | 
					                    int length = m - start;
 | 
				
			||||||
 | 
					                    commit = s.mid(start, length).trimmed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    start = m + 2;
 | 
				
			||||||
 | 
					                    if (d >= start) {
 | 
				
			||||||
 | 
					                        length = d - start;
 | 
				
			||||||
 | 
					                        msg = s.mid(start, length).trimmed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        start = d + 2;
 | 
				
			||||||
 | 
					                        date = s.mid(start);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (!commit.isEmpty() && !msg.isEmpty() && !date.isEmpty()) {
 | 
				
			||||||
 | 
					                    lst << commit << msg << date;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        qCritical() << "CUSTOMER_REPOSITORY" << m_customerRepository
 | 
				
			||||||
 | 
					                    << "DOES NOT EXIST";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return lst;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 Zu beachten: wird eine datei neu hinzugefuegt (git add/commit) dann aber gleich
 | 
					 Zu beachten: wird eine datei neu hinzugefuegt (git add/commit) dann aber gleich
 | 
				
			||||||
 wieder geloscht, so wird sie im diff nicht angezeigt.
 | 
					 wieder geloscht, so wird sie im diff nicht angezeigt.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,6 +50,7 @@ class GitClient : public QObject {
 | 
				
			|||||||
    std::optional<QStringList> gitMerge();
 | 
					    std::optional<QStringList> gitMerge();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString gitLastCommit(QString fileName);
 | 
					    QString gitLastCommit(QString fileName);
 | 
				
			||||||
 | 
					    QStringList gitShowReason();
 | 
				
			||||||
    QString gitBlob(QString fileName);
 | 
					    QString gitBlob(QString fileName);
 | 
				
			||||||
    QString gitCommitForBlob(QString blob);
 | 
					    QString gitCommitForBlob(QString blob);
 | 
				
			||||||
    bool gitIsFileTracked(QString file2name);
 | 
					    bool gitIsFileTracked(QString file2name);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user