From 1edc5ec7cd0f7d34bf75c81aef307d53e59ba9da Mon Sep 17 00:00:00 2001 From: Joseph Aquino Date: Fri, 26 Dec 2025 01:26:54 -0500 Subject: [PATCH] minor fixes --- CMakeLists.txt | 2 ++ src/commands/commit-tree.cpp | 6 ++++-- src/commands/write-tree.cpp | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38bbb78..725140a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,5 +34,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT basic-vcs) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_link_libraries(basic-vcs PRIVATE curl) + endif() \ No newline at end of file diff --git a/src/commands/commit-tree.cpp b/src/commands/commit-tree.cpp index c83699d..e27b506 100644 --- a/src/commands/commit-tree.cpp +++ b/src/commands/commit-tree.cpp @@ -122,8 +122,10 @@ int commitTree(int argc, const char** argv) SHA1 checksum; checksum.update(commitObject); const std::string hash = checksum.final(); - const std::filesystem::path hashDir{ std::filesystem::current_path() / ".git" / "objects" / hash.substr(0,2) }; - const std::filesystem::path objectFullPath{ hashDir / hash.substr(2) }; + std::cout << hash << "\n"; + + const std::filesystem::path hashDir{ std::filesystem::current_path() / ".git" / "objects" / hash.substr(0,2) }; + const std::filesystem::path objectFullPath{ hashDir / hash.substr(2) }; if (!std::filesystem::exists(hashDir)) { diff --git a/src/commands/write-tree.cpp b/src/commands/write-tree.cpp index 4f691d4..2025549 100644 --- a/src/commands/write-tree.cpp +++ b/src/commands/write-tree.cpp @@ -85,13 +85,13 @@ std::string hashDir(const std::string& path) std::string fileContent {std::istreambuf_iterator(file), std::istreambuf_iterator()}; SHA1 checksum; - std::string blob = "blob " + std::to_string(fileContent.size()); + std::string blob = "blob " + std::to_string(fileContent.size()); blob.append("\0"); blob.append(fileContent); - checksum.update(blob); + checksum.update(blob); - nodes.emplace_back(object.path().filename().string(), 100644, checksum.final()); + nodes.emplace_back(object.path().filename().string(), 100644, checksum.final()); file.close(); }