36namespace fs = std::filesystem;
109 std::map<fs::path, IndexEntry> entries;
118 fs::path index_file_path;
127 fs::path repo_root_path;
151 static void getFileMetaData(
const fs::path& full_path,
152 long long& size, fs::file_time_type& mtime);
168 Index(
const fs::path& vcs_root_path, fs::path repo_root_path,
ObjectStorage& storage);
234 [[nodiscard]]
bool write()
const;
247 [[nodiscard]]
bool isFileModified(
const fs::path& file_path)
const;
262 void stage_file(
const fs::path& relative_path);
Manages the reading, writing, and lifecycle of VCS objects on the disk using the Git format.
Manages the Staging Area (Index) of the VCS repository.
Definition Index.hxx:68
bool isFileModified(const fs::path &file_path) const
Checks if a file in the working directory has been modified since it was last staged.
Definition Index.cxx:101
std::string createTreeObject()
Creates the hierarchical Tree structure based on the current staged entries and saves the Tree object...
Definition Index.cxx:250
void stage_file(const fs::path &relative_path)
Stages a file by creating a Blob object, saving it to storage, and updating the Index entry (Core log...
Definition Index.cxx:68
void save() const
Saves the current state of the index entries to the index file (temporary text format).
Definition Index.cxx:153
Index(const fs::path &vcs_root_path, fs::path repo_root_path, ObjectStorage &storage)
Constructs the Index manager, setting up paths and loading the index.
Definition Index.cxx:46
const IndexEntry * getEntry(const fs::path &file_path) const
Retrieves an entry from the index by its relative file path.
Definition Index.cxx:60
void addEntry(const IndexEntry &entry)
Adds or updates an entry in the staging area.
Definition Index.cxx:56
bool write() const
Another saving function (like load) but returns bool.
Definition Index.cxx:221
void load()
Loads the index entries from the index file on disk (temporary text format).
Definition Index.cxx:175
Manages the version control object database, including persistence and object restoration.
Definition ObjectStorage.hxx:40
Core VCS data structures and object model.
Represents a single file entry in the staging area (Index).
Definition Index.hxx:35
long long file_size
The size of the file in bytes.
Definition Index.hxx:58
fs::path file_path
The file's path, relative to the repository's root directory.
Definition Index.hxx:46
fs::file_time_type last_modified
The time of the file's last modification, used to detect changes.
Definition Index.hxx:52
std::string blob_hash
The SHA-256 hash of the file's content (the Blob object ID).
Definition Index.hxx:40