| 483 | } |
| 484 | |
| 485 | static bool check_if_file_is_encrypted (const std::string& filename) |
| 486 | { |
| 487 | // git ls-files -sz filename |
| 488 | std::vector<std::string> command; |
| 489 | command.push_back("git"); |
| 490 | command.push_back("ls-files"); |
| 491 | command.push_back("-sz"); |
| 492 | command.push_back("--"); |
| 493 | command.push_back(filename); |
| 494 | |
| 495 | std::stringstream output; |
| 496 | if (!successful_exit(exec_command(command, output))) { |
| 497 | throw Error("'git ls-files' failed - is this a Git repository?"); |
| 498 | } |
| 499 | |
| 500 | if (output.peek() == -1) { |
| 501 | return false; |
| 502 | } |
| 503 | |
| 504 | std::string mode; |
| 505 | std::string object_id; |
| 506 | output >> mode >> object_id; |
| 507 | |
| 508 | return check_if_blob_is_encrypted(object_id); |
| 509 | } |
| 510 | |
| 511 | static bool is_git_file_mode (const std::string& mode) |
| 512 | { |
no test coverage detected