X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=read-cache.c;h=6eff4c8401b820b001a3ed48e8086c4cf1cd8f5c;hb=34143b2639625f29edf7b1c0c5af58e545845911;hp=5820f18d9a79fd83ff5a418a5dfc68bbf7c5c354;hpb=6b7242aa1acc3c7835f80522914ffc4b2e789a29;p=git.git diff --git a/read-cache.c b/read-cache.c index 5820f18d..6eff4c84 100644 --- a/read-cache.c +++ b/read-cache.c @@ -191,6 +191,8 @@ int ce_path_match(const struct cache_entry *ce, const char **pathspec) return 1; if (name[matchlen] == '/' || !name[matchlen]) return 1; + if (!matchlen) + return 1; } return 0; } @@ -460,6 +462,13 @@ static int ce_flush(SHA_CTX *context, int fd) SHA1_Update(context, write_buffer, left); } + /* Flush first if not enough space for SHA1 signature */ + if (left + 20 > WRITE_BUFFER_SIZE) { + if (write(fd, write_buffer, left) != left) + return -1; + left = 0; + } + /* Append the SHA1 signature at the end */ SHA1_Final(write_buffer + left, context); left += 20;