60 std::string tree_hash;
69 std::vector<std::string> parent_hashes;
87 std::time_t timestamp;
106 Commit() : tree_hash(
""), parent_hashes({}), author(
""), timestamp(time_t()), message(
"") {};
129 std::vector<std::string> phashes,
132 std::time_t tstamp = std::time(
nullptr)
147 [[nodiscard]] std::string
getType()
const override;
161 [[nodiscard]] std::string
serialize()
const override;
187 [[nodiscard]]
const std::string&
getTreeHash()
const;
209 [[nodiscard]]
const std::string&
getAuthor()
const;
231 [[nodiscard]]
const std::string&
getMessage()
const;
273 void setParent(
const std::string& parent);
Definition of the abstract base class for all Version Control System objects.
std::time_t getTimestamp() const
Returns the UNIX timestamp of the commit creation.
Definition Commit.cxx:173
std::string getType() const override
Returns the type of the VCS object.
Definition Commit.cxx:43
std::string serialize() const override
Serializes the Commit metadata into a standardized, canonical format for hashing and storage.
Definition Commit.cxx:47
const std::string & getMessage() const
Returns the user-defined commit message.
Definition Commit.cxx:177
const std::string & getTreeHash() const
Returns the hash ID of the associated root Tree object.
Definition Commit.cxx:161
void setTimestamp(std::time_t tstamp)
Sets the commit timestamp.
Definition Commit.cxx:188
void setMessage(const std::string &msg)
Sets the commit message.
Definition Commit.cxx:181
const std::vector< std::string > & getParentHashes() const
Returns the hash IDs of the parent commits.
Definition Commit.cxx:165
static Commit deserialize(const std::string &raw_content)
Creates a Commit object from a serialized string read from the object database.
Definition Commit.cxx:64
void setTimestampNow()
Sets the commit timestamp to the current time.
Definition Commit.cxx:192
void setParent(const std::string &parent)
Sets a parent commit hash.
Definition Commit.cxx:196
Commit()
Default constructor.
Definition Commit.hxx:72
const std::string & getAuthor() const
Returns the author and email string for the commit.
Definition Commit.cxx:169
VcsObject()=default
Default constructor. Required for derived classes.
Core VCS data structures and object model.