MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / calculate_git_blob_oid

Function calculate_git_blob_oid

src/pull/download_model.cpp:33–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33std::string calculate_git_blob_oid(const std::string& file_path) {
34 std::ifstream file(file_path, std::ios::binary);
35 if (!file.is_open()) {
36 return "";
37 }
38 file.seekg(0, std::ios::end);
39 size_t size = file.tellg();
40 file.seekg(0, std::ios::beg);
41
42 std::ostringstream oss;
43 oss << "blob " << size << '\0'; // Git blob header
44 oss << file.rdbuf();
45
46 std::string blob_data = oss.str();
47 SHA1 sha1;
48 sha1.update(blob_data);
49 return sha1.final();
50}
51
52// Global variable to track if progress bar was shown
53static bool g_progress_bar_shown = false;

Callers 2

download_fileFunction · 0.85

Calls 2

updateMethod · 0.80
finalMethod · 0.80

Tested by

no test coverage detected