diff options
author | Patryk Obara <patryk.obara@gmail.com> | 2018-01-28 00:13:19 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-30 18:42:36 (GMT) |
commit | a09c985eae694db1cf31c72db0e2e1bf42f1274f (patch) | |
tree | 3acdfc26ab59d2ac822e4b4cf6ad93bf746fb65d /read-cache.c | |
parent | bbca96d579b31900c9c0ad39299a3c9a3bd276f9 (diff) | |
download | git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.zip git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.tar.gz git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.tar.bz2 |
sha1_file: convert write_sha1_file to object_id
Convert the definition and declaration of write_sha1_file to
struct object_id and adjust usage of this function.
This commit also converts static function write_sha1_file_prepare, as it
is closely related.
Rename these functions to write_object_file and
write_object_file_prepare respectively.
Replace sha1_to_hex, hashcpy and hashclr with their oid equivalents
wherever possible.
Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c index 2eb81a6..01bcf7d 100644 --- a/read-cache.c +++ b/read-cache.c @@ -631,10 +631,10 @@ static struct cache_entry *create_alias_ce(struct index_state *istate, void set_object_name_for_intent_to_add_entry(struct cache_entry *ce) { - unsigned char sha1[20]; - if (write_sha1_file("", 0, blob_type, sha1)) + struct object_id oid; + if (write_object_file("", 0, blob_type, &oid)) die("cannot create an empty blob in the object database"); - hashcpy(ce->oid.hash, sha1); + oidcpy(&ce->oid, &oid); } int add_to_index(struct index_state *istate, const char *path, struct stat *st, int flags) |