Make hash-object more robust against malformed objects
Commits, trees and tags have structure. Don't let users feed git with malformed ones. Sooner or later git will die() when encountering them. Note that this patch does not check semantics. A tree that points to non-existent objects is perfectly OK (and should be so, users may choose to add commit first, then its associated tree for example). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cf7b1cad0e
commit
c879daa237
@ -92,7 +92,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st)
|
||||
|
||||
if (fd >= 0) {
|
||||
unsigned char sha1[20];
|
||||
if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name))
|
||||
if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name, 0))
|
||||
match = hashcmp(sha1, ce->sha1);
|
||||
/* index_fd() closed the file descriptor already */
|
||||
}
|
||||
|
Reference in New Issue
Block a user