00001
00089 $object = new GitBlob($repo);
00090 @endcode
00091
00092 @note
00093 It is good practice to use \c clone when modifying an object you received from
00094 Git::getObject() or another glip function calling it. Objects might be cached
00095 across Git::getObject() calls in future.
00096
00097 You should then modify the object's public attributes accordingly, either
00098 directly or through helper functions like GitTree::updateNode(). When you're
00099 finished modifying, you need to update glip's internal cached hash value by
00100 using GitObject::rehash().
00101
00102 @attention
00103 GitObject::getName() and all functions relying on it (including glip
00104 functions) may behave strangely if you fail to call GitObject::rehash() after
00105 modifying public attributes. This can ultimately lead to corrupted
00106 repositories.
00107
00108 @note
00109 For performance reasons, you should not call GitObject::rehash() unless you
00110 really have to.
00111
00112 @code
00113 $object = new GitBlob($repo);
00114 $object->data = "Hello World\n";
00115 $object->rehash();
00116 @endcode
00117
00118 You can now use GitObject::getName() to get the object's SHA-1 sum and
00119 possibly reference it in other GitObject%s.
00120
00121 The object has not written to disk yet. To do so, use GitObject::write():
00122 @code
00123 $object->write();
00124 @endcode
00125
00126 Et voilĂ ! You just wrote a new object to a git repository from PHP. If you
00127 actually execute the example code listed here, the result will be similar to
00128 that of <tt>echo Hello World | git hash-object -w --stdin</tt>.
00129
00130 The same procedure applies to GitTree and GitCommit as well, just that they
00131 have different attributes to modify.
00132
00133 */