Add change 08 instructions
This commit is contained in:
parent
30ee2098ab
commit
d666efcbd3
26
how_to/Change_08.md
Normal file
26
how_to/Change_08.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- write-tree: List files
|
||||||
|
|
||||||
|
The next command is `write-tree`. This command will take the current working
|
||||||
|
directory and store it to the object database. If `hash-object` was for storing
|
||||||
|
an individual file, then `write-tree` is for storing a whole directory.
|
||||||
|
|
||||||
|
Like `hash-object`, `write-tree` is going to give us an OID after it's done and
|
||||||
|
we'll be able to use the OID in order to retrieve the directory at a later time.
|
||||||
|
|
||||||
|
In Git's lingo a "tree" means a directory.
|
||||||
|
|
||||||
|
We'll get into the details in later changes, in this change we'll only prepare
|
||||||
|
the code around the feature:
|
||||||
|
|
||||||
|
+ Create a `write-tree` CLI command
|
||||||
|
|
||||||
|
+ Create a `write_tree()` function in base module. Why in base module and not
|
||||||
|
in data module? Because `write_tree()` is not going to write to disk directly
|
||||||
|
but use the object database provided by data to store the directory. Hence it
|
||||||
|
belongs to the higher-level base module.
|
||||||
|
|
||||||
|
+ Add code to `write_tree()` to print a directory recursively. For now nothing
|
||||||
|
is written anywhere, but we just coded the boilerplate to recursively scan a
|
||||||
|
directory.
|
||||||
|
|
||||||
|
We continue in the next change.
|
Loading…
Reference in New Issue
Block a user