From 494fbdb0d2d486ba43dd655e2fa126bfa881f44b Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 19 Oct 2011 15:49:13 +0000 Subject: Git: Do the right thing when commiting Do the right thing when commiting in git. This allows staged files to be commited without additional changes, etc. Change-Id: Ib04c91cf9c105c4a2bbe013926112d6d5d3bade6 Reviewed-by: Tobias Hunger --- src/plugins/git/commitdata.h | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'src/plugins/git/commitdata.h') diff --git a/src/plugins/git/commitdata.h b/src/plugins/git/commitdata.h index b31bf73c2f..e76f1e1b52 100644 --- a/src/plugins/git/commitdata.h +++ b/src/plugins/git/commitdata.h @@ -69,34 +69,50 @@ QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &); class CommitData { public: + enum FileState { + UntrackedFile = 0, + + StagedFile = 1, + ModifiedFile = 2, + AddedFile = 3, + DeletedFile = 4, + RenamedFile = 8, + CopiedFile = 16, + UpdatedFile = 32, + + ModifiedStagedFile = StagedFile | ModifiedFile, + AddedStagedFile = StagedFile | AddedFile, + DeletedStagedFile = StagedFile | DeletedFile, + RenamedStagedFile = StagedFile | RenamedFile, + CopiedStagedFile = StagedFile | CopiedFile, + UpdatedStagedFile = StagedFile | UpdatedFile, + + AllStates = UpdatedFile | CopiedFile | RenamedFile | DeletedFile | AddedFile | ModifiedFile | StagedFile, + UnknownFileState + }; + // A pair of state string/file name ('modified', 'file.cpp'). - typedef QPair StateFilePair; + typedef QPair StateFilePair; void clear(); // Parse the files and the branch of panelInfo // from a git status output bool parseFilesFromStatus(const QString &output); - bool filesEmpty() const; - // Convenience to retrieve the file names from // the specification list. Optionally filter for a certain state - QStringList stagedFileNames(const QString &stateFilter = QString()) const; - QStringList unstagedFileNames(const QString &stateFilter = QString()) const; + QStringList filterFiles(const FileState &state = AllStates) const; + + static QString stateDisplayName(const FileState &state); QString amendSHA1; QString commitEncoding; GitSubmitEditorPanelInfo panelInfo; GitSubmitEditorPanelData panelData; - QList stagedFiles; - QList unstagedFiles; - QStringList untrackedFiles; + QList files; }; -QDebug operator<<(QDebug d, const CommitData &); - - } // namespace Internal } // namespace Git -- cgit v1.2.1