forked from qt-creator/qt-creator
Git: Make file state resolving more accurate
Change-Id: I238ef964df126a341c87dacf9344ff1570f31845 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
ae58073080
commit
2c68c80196
@@ -90,7 +90,7 @@ static FileStates stateFor(const QChar &c)
|
||||
{
|
||||
switch (c.unicode()) {
|
||||
case ' ':
|
||||
return UntrackedFile;
|
||||
return EmptyFileState;
|
||||
case 'M':
|
||||
return ModifiedFile;
|
||||
case 'A':
|
||||
@@ -103,6 +103,8 @@ static FileStates stateFor(const QChar &c)
|
||||
return CopiedFile;
|
||||
case 'U':
|
||||
return UnmergedFile;
|
||||
case '?':
|
||||
return UntrackedFile;
|
||||
default:
|
||||
return UnknownFileState;
|
||||
}
|
||||
@@ -144,11 +146,10 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
|
||||
files.append(qMakePair(xState | UnmergedFile | UnmergedUs, file));
|
||||
}
|
||||
} else {
|
||||
xState |= StagedFile;
|
||||
if (xState != StagedFile)
|
||||
files.append(qMakePair(xState, file));
|
||||
if (xState != EmptyFileState)
|
||||
files.append(qMakePair(xState | StagedFile, file));
|
||||
|
||||
if (yState != UntrackedFile) {
|
||||
if (yState != EmptyFileState) {
|
||||
QString newFile = file;
|
||||
if (xState & (RenamedFile | CopiedFile))
|
||||
newFile = file.mid(file.indexOf(QLatin1String(" -> ")) + 4);
|
||||
|
||||
@@ -64,7 +64,7 @@ struct GitSubmitEditorPanelData
|
||||
QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &);
|
||||
|
||||
enum FileState {
|
||||
UntrackedFile = 0,
|
||||
EmptyFileState = 0x00,
|
||||
|
||||
StagedFile = 0x01,
|
||||
ModifiedFile = 0x02,
|
||||
@@ -77,6 +77,7 @@ enum FileState {
|
||||
UnmergedUs = 0x100,
|
||||
UnmergedThem = 0x200,
|
||||
|
||||
UntrackedFile = 0x400,
|
||||
UnknownFileState = 0x800
|
||||
};
|
||||
Q_DECLARE_FLAGS(FileStates, FileState)
|
||||
|
||||
@@ -1804,7 +1804,8 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
// MM filename
|
||||
// A new_unstaged_file
|
||||
// R old -> new
|
||||
// ?? missing_file
|
||||
// D deleted_file
|
||||
// ?? untracked_file
|
||||
if (status != StatusUnchanged) {
|
||||
if (!commitData->parseFilesFromStatus(output)) {
|
||||
*errorMessage = msgParseFilesFailed();
|
||||
|
||||
Reference in New Issue
Block a user