object API: rename hash_object_file_literally() to write_*()
Before 0c3db67cc8
(hash-object --literally: fix buffer overrun with
extra-long object type, 2015-05-04) the hash-object code being changed
here called write_sha1_file() to both hash and write a loose
object. Before that we'd use hash_sha1_file() to if "-w" wasn't
provided, and otherwise call write_sha1_file().
Now we'll always call the same function for both writing. Let's rename
it from hash_*_literally() to write_*_literally(). Even though the
write_*() might not actually write if HASH_WRITE_OBJECT isn't in
"flags", having it be more similar to write_object_file_flags() than
hash_object_file(), but carrying a name that would suggest that it's a
variant of the latter is confusing.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0f156dbb04
commit
0ff7b4f976
@ -25,7 +25,7 @@ static int hash_literally(struct object_id *oid, int fd, const char *type, unsig
|
|||||||
if (strbuf_read(&buf, fd, 4096) < 0)
|
if (strbuf_read(&buf, fd, 4096) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
else
|
else
|
||||||
ret = hash_object_file_literally(buf.buf, buf.len, type, oid,
|
ret = write_object_file_literally(buf.buf, buf.len, type, oid,
|
||||||
flags);
|
flags);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2027,7 +2027,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
|
|||||||
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
|
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hash_object_file_literally(const void *buf, unsigned long len,
|
int write_object_file_literally(const void *buf, unsigned long len,
|
||||||
const char *type, struct object_id *oid,
|
const char *type, struct object_id *oid,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ static inline int write_object_file(const void *buf, unsigned long len,
|
|||||||
return write_object_file_flags(buf, len, type, oid, 0);
|
return write_object_file_flags(buf, len, type, oid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hash_object_file_literally(const void *buf, unsigned long len,
|
int write_object_file_literally(const void *buf, unsigned long len,
|
||||||
const char *type, struct object_id *oid,
|
const char *type, struct object_id *oid,
|
||||||
unsigned flags);
|
unsigned flags);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user