git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5] read-cache: force_verify_index_checksum

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Apr 5, 2017, 18:08 UTC
Message-ID
<18953c00-0eb0-c1e0-0d29-070e0ec60280@jeffhostetler.com>
In-Reply-To
<20170405170336.GE8741@aiede.mtv.corp.google.com>
On 4/5/2017 1:03 PM, Jonathan Nieder wrote:
Show 24 quoted lines
> Hi,
>
> git@jeffhostetler.com wrote:
>
>> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
>> ---
>>  builtin/fsck.c  |  1 +
>>  cache.h         |  2 ++
>>  read-cache.c    |  7 +++++++
>>  t/t1450-fsck.sh | 11 +++++++++++
>>  4 files changed, 21 insertions(+)
>
> Yay!  I love this version.
>
>> --- a/builtin/fsck.c
>> +++ b/builtin/fsck.c
>> @@ -771,6 +771,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
>>  	}
>>
>>  	if (keep_cache_objects) {
>> +		force_verify_index_checksum = 1;
>
> nit: now that there isn't a config this is overriding, this isn't
> "force_verify" so much as "verify".
good point.
Show 29 quoted lines
>
> [...]
>> +++ b/t/t1450-fsck.sh
>> @@ -689,4 +689,15 @@ test_expect_success 'bogus head does not fallback to all heads' '
>>  	! grep $blob out
>>  '
>>
>> +test_expect_success PERL 'detect corrupt index file in fsck' '
>> +	cp .git/index .git/index.backup &&
>> +	echo zzzzzzzz >zzzzzzzz &&
>> +	git add zzzzzzzz &&
>> +	perl -pi -e "s/zzzzzzzz/yyyyyyyy/" .git/index &&
>> +	test_must_fail git fsck --cache &&
>> +	rm .git/index &&
>> +	mv .git/index.backup .git/index &&
>> +	rm zzzzzzzz
>> +'
>
> This is great.
>
> optional: you can do the cleanup commands in test_when_finished to
> make sure they happen even if the test fails.
>
> Tests don't seem to use "perl -pi" anywhere else.  This instance could
> be simplified by using sed.
>
> With whatever subset of the changes below look good,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
> [...]
good point.

I just pushed another version. Thanks, Jeff

Previous: Jonathan Nieder
Message 4 of 4 in “read-cache: call verify_hdr() in a background thread”
  1. read-cache: call verify_hdr() in a background threadgit@jeffhostetler.com, Apr 5, 2017
  2. read-cache: force_verify_index_checksumgit@jeffhostetler.com, Apr 5, 2017
  3. Jonathan NiederApr 5, 2017
  4. Jeff HostetlerApr 5, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.