X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fupdate-index.c;h=a6a23fa1f3c7782566d7fcfe470dd424b876e4a5;hb=7aa50897dda0360b9cbbe23e723a5aee461e1d71;hp=d7850c6309aec0c1a4f640999fb757d7b32ba1b8;hpb=46bf76ac317031818ca7ff8d44d35ff79dae61d2;p=git.git diff --git a/builtin/update-index.c b/builtin/update-index.c index d7850c630..a6a23fa1f 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -99,8 +99,11 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru fill_stat_cache_info(ce, st); ce->ce_mode = ce_mode_from_stat(old, st->st_mode); - if (index_path(ce->sha1, path, st, !info_only)) + if (index_path(ce->sha1, path, st, + info_only ? 0 : HASH_WRITE_OBJECT)) { + free(ce); return -1; + } option = allow_add ? ADD_CACHE_OK_TO_ADD : 0; option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0; if (add_cache_entry(ce, option))