| 31 | } |
| 32 | |
| 33 | std::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 |
| 53 | static bool g_progress_bar_shown = false; |
no test coverage detected