Skip to content

Commit 1fdc232

Browse files
committed
git_index_write_tree doesn't write the index
1 parent c27d2d0 commit 1fdc232

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/examples/init/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ Since the repo was *just* initialized, the index has an empty tree.
248248
git_index_free(index);
249249
```
250250

251-
Now we have the empty tree's SHA-1 hash, but we need an actual `git_tree` object to create a commit.
251+
It's worth noting that this doesn't actually write the index to disk.
252+
There's a separate call for that: [`git_index_write`](http://libgit2.github.com/libgit2/#HEAD/group/index/git_index_write).
253+
All this code does is use the empty index to get the SHA-1 hash of the empty tree.
254+
255+
Okay, now we have the empty tree's SHA-1 hash, but we need an actual `git_tree` object to create a commit.
252256

253257
```c
254258
if (git_tree_lookup(&tree, repo, &tree_id) < 0)

0 commit comments

Comments
 (0)