Staging
v0.5.2
https://github.com/git/git
Revision 7ac4f3a007e2567f9d2492806186aa063f9a08d6 authored by Jeff King on 02 May 2018, 19:44:51 UTC, committed by Jeff King on 22 May 2018, 03:55:12 UTC
Because fscking a blob has always been a noop, we didn't
bother passing around the blob data. In preparation for
content-level checks, let's fix up a few things:

  1. The fsck_object() function just returns success for any
     blob. Let's a noop fsck_blob(), which we can fill in
     with actual logic later.

  2. The fsck_loose() function in builtin/fsck.c
     just threw away blob content after loading it. Let's
     hold onto it until after we've called fsck_object().

     The easiest way to do this is to just drop the
     parse_loose_object() helper entirely. Incidentally,
     this also fixes a memory leak: if we successfully
     loaded the object data but did not parse it, we would
     have left the function without freeing it.

  3. When fsck_loose() loads the object data, it
     does so with a custom read_loose_object() helper. This
     function streams any blobs, regardless of size, under
     the assumption that we're only checking the sha1.

     Instead, let's actually load blobs smaller than
     big_file_threshold, as the normal object-reading
     code-paths would do. This lets us fsck small files, and
     a NULL return is an indication that the blob was so big
     that it needed to be streamed, and we can pass that
     information along to fsck_blob().

Signed-off-by: Jeff King <peff@peff.net>
1 parent ed9c322
History
Tip revision: 7ac4f3a007e2567f9d2492806186aa063f9a08d6 authored by Jeff King on 02 May 2018, 19:44:51 UTC
fsck: actually fsck blob data
Tip revision: 7ac4f3a
File Mode Size
nedmalloc
poll
regex
vcbuild
win32
apple-common-crypto.h -rw-r--r-- 2.7 KB
basename.c -rw-r--r-- 1.3 KB
bswap.h -rw-r--r-- 5.1 KB
cygwin.c -rw-r--r-- 407 bytes
cygwin.h -rw-r--r-- 108 bytes
fopen.c -rw-r--r-- 938 bytes
gmtime.c -rw-r--r-- 605 bytes
hstrerror.c -rw-r--r-- 530 bytes
inet_ntop.c -rw-r--r-- 4.8 KB
inet_pton.c -rw-r--r-- 6.8 KB
memmem.c -rw-r--r-- 752 bytes
mingw.c -rw-r--r-- 58.5 KB
mingw.h -rw-r--r-- 14.6 KB
mkdir.c -rw-r--r-- 468 bytes
mkdtemp.c -rw-r--r-- 153 bytes
mmap.c -rw-r--r-- 692 bytes
msvc.c -rw-r--r-- 113 bytes
msvc.h -rw-r--r-- 570 bytes
obstack.c -rw-r--r-- 13.7 KB
obstack.h -rw-r--r-- 19.0 KB
pread.c -rw-r--r-- 433 bytes
precompose_utf8.c -rw-r--r-- 4.6 KB
precompose_utf8.h -rw-r--r-- 1.3 KB
qsort.c -rw-r--r-- 1.2 KB
qsort_s.c -rw-r--r-- 1.3 KB
setenv.c -rw-r--r-- 862 bytes
sha1-chunked.c -rw-r--r-- 362 bytes
sha1-chunked.h -rw-r--r-- 81 bytes
snprintf.c -rw-r--r-- 1.5 KB
stat.c -rw-r--r-- 1.1 KB
strcasestr.c -rw-r--r-- 431 bytes
strdup.c -rw-r--r-- 169 bytes
strlcpy.c -rw-r--r-- 247 bytes
strtoimax.c -rw-r--r-- 214 bytes
strtoumax.c -rw-r--r-- 217 bytes
terminal.c -rw-r--r-- 2.5 KB
terminal.h -rw-r--r-- 142 bytes
unsetenv.c -rw-r--r-- 591 bytes
win32.h -rw-r--r-- 878 bytes
win32mmap.c -rw-r--r-- 1.1 KB
winansi.c -rw-r--r-- 15.8 KB

back to top