diff --git a/docs/ko/reference/Commit/Methods/treeId.md b/docs/ko/reference/Commit/Methods/treeId.md new file mode 100644 index 0000000..853e05e --- /dev/null +++ b/docs/ko/reference/Commit/Methods/treeId.md @@ -0,0 +1,23 @@ +# treeId + +이 커밋이 가리키는 트리의 ID를 가져와요. + +ODB에서 Git 개체를 가져오기 위한 시도는 하지 않아요. + +## 시그니처 + +```ts +class Commit { + treeId(): string; +} +``` + +### 반환 값 + + \ No newline at end of file diff --git a/docs/reference/Commit/Methods/treeId.md b/docs/reference/Commit/Methods/treeId.md new file mode 100644 index 0000000..b538e4b --- /dev/null +++ b/docs/reference/Commit/Methods/treeId.md @@ -0,0 +1,23 @@ +# treeId + +Get the id of the tree pointed to by this commit. + +No attempts are made to fetch an object from the ODB. + +## Signature + +```ts +class Commit { + treeId(): string; +} +``` + +### Returns + + \ No newline at end of file diff --git a/src/commit.rs b/src/commit.rs index 48c0959..184d9df 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -227,6 +227,25 @@ impl Commit { Ok(time) } + #[napi] + /// Get the id of the tree pointed to by this commit. + /// + /// No attempts are made to fetch an object from the ODB. + /// + /// @category Commit/Methods + /// + /// @signature + /// ```ts + /// class Commit { + /// treeId(): string; + /// } + /// ``` + /// + /// @returns Get the id of the tree pointed to by a commit. + pub fn tree_id(&self) -> String { + self.inner.tree_id().to_string() + } + #[napi] /// Get the tree pointed to by a commit. ///