MCPcopy Create free account
hub / github.com/ByConity/ByConity / processFileChanges

Function processFileChanges

programs/git-import/git-import.cpp:788–868  ·  view source on GitHub ↗

File changes in form * :100644 100644 b90fe6bb94 3ffe4c380f M src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp * :100644 100644 828dedf6b5 828dedf6b5 R100 dbms/src/Functions/GeoUtils.h dbms/src/Functions/PolygonUtils.h * according to the output of 'git show --raw' */

Source from the content-addressed store, hash-verified

786 * according to the output of 'git show --raw'
787 */
788void processFileChanges(
789 ReadBuffer & in,
790 const Options & options,
791 Commit & commit,
792 CommitDiff & file_changes)
793{
794 while (checkChar(':', in))
795 {
796 FileChange file_change;
797
798 /// We don't care about file mode and content hashes.
799 for (size_t i = 0; i < 4; ++i)
800 {
801 skipUntilWhitespace(in);
802 skipWhitespaceIfAny(in);
803 }
804
805 char change_type;
806 readChar(change_type, in);
807
808 /// For rename and copy there is a number called "score". We ignore it.
809 int score;
810
811 switch (change_type)
812 {
813 case 'A':
814 file_change.change_type = FileChangeType::Add;
815 ++commit.files_added;
816 break;
817 case 'D':
818 file_change.change_type = FileChangeType::Delete;
819 ++commit.files_deleted;
820 break;
821 case 'M':
822 file_change.change_type = FileChangeType::Modify;
823 ++commit.files_modified;
824 break;
825 case 'R':
826 file_change.change_type = FileChangeType::Rename;
827 ++commit.files_renamed;
828 readText(score, in);
829 break;
830 case 'C':
831 file_change.change_type = FileChangeType::Copy;
832 readText(score, in);
833 break;
834 case 'T':
835 file_change.change_type = FileChangeType::Type;
836 break;
837 default:
838 throw Exception(ErrorCodes::INCORRECT_DATA, "Unexpected file change type: {}", change_type);
839 }
840
841 skipWhitespaceIfAny(in);
842
843 if (change_type == 'R' || change_type == 'C')
844 {
845 readText(file_change.old_path, in);

Callers 1

processCommitFunction · 0.85

Calls 11

checkCharFunction · 0.85
skipUntilWhitespaceFunction · 0.85
skipWhitespaceIfAnyFunction · 0.85
readCharFunction · 0.85
assertCharFunction · 0.85
FileDiffClass · 0.85
frontMethod · 0.80
readTextFunction · 0.50
ExceptionClass · 0.50
emptyMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected