コード例 #1
0
ファイル: StatusEntry.cs プロジェクト: Xornent/simula
 internal StatusEntry(string filePath, FileStatus state, RenameDetails headToIndexRenameDetails = null, RenameDetails indexToWorkDirRenameDetails = null)
 {
     this.filePath = filePath;
     this.state    = state;
     this.headToIndexRenameDetails    = headToIndexRenameDetails;
     this.indexToWorkDirRenameDetails = indexToWorkDirRenameDetails;
 }
コード例 #2
0
ファイル: RepositoryStatus.cs プロジェクト: Xornent/simula
        private unsafe void AddStatusEntryForDelta(FileStatus gitStatus, git_diff_delta *deltaHeadToIndex, git_diff_delta *deltaIndexToWorkDir)
        {
            RenameDetails headToIndexRenameDetails    = null;
            RenameDetails indexToWorkDirRenameDetails = null;

            if ((gitStatus & FileStatus.RenamedInIndex) == FileStatus.RenamedInIndex)
            {
                headToIndexRenameDetails =
                    new RenameDetails(LaxUtf8Marshaler.FromNative(deltaHeadToIndex->old_file.Path),
                                      LaxUtf8Marshaler.FromNative(deltaHeadToIndex->new_file.Path),
                                      (int)deltaHeadToIndex->similarity);
            }

            if ((gitStatus & FileStatus.RenamedInWorkdir) == FileStatus.RenamedInWorkdir)
            {
                indexToWorkDirRenameDetails =
                    new RenameDetails(LaxUtf8Marshaler.FromNative(deltaIndexToWorkDir->old_file.Path),
                                      LaxUtf8Marshaler.FromNative(deltaIndexToWorkDir->new_file.Path),
                                      (int)deltaIndexToWorkDir->similarity);
            }

            var filePath = LaxUtf8Marshaler.FromNative(deltaIndexToWorkDir != null ?
                                                       deltaIndexToWorkDir->new_file.Path :
                                                       deltaHeadToIndex->new_file.Path);

            StatusEntry statusEntry = new StatusEntry(filePath, gitStatus, headToIndexRenameDetails, indexToWorkDirRenameDetails);

            if (gitStatus == FileStatus.Unaltered)
            {
                unaltered.Add(statusEntry);
            }
            else
            {
                foreach (KeyValuePair <FileStatus, Action <RepositoryStatus, StatusEntry> > kvp in dispatcher)
                {
                    if (!gitStatus.HasFlag(kvp.Key))
                    {
                        continue;
                    }

                    kvp.Value(this, statusEntry);
                }
            }

            statusEntries.Add(statusEntry);
        }