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

Function processFileChanges

programs/git-import/git-import.cpp:797–877  ·  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

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

Tested by

no test coverage detected