diff options
| author | Junio C Hamano <gitster@pobox.com> | 2010-08-18 12:16:41 -0700 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2010-08-18 12:16:41 -0700 | 
| commit | cdcf08e0689ca030dcfc5aede5eb81d4d8e3f77c (patch) | |
| tree | 4e5a10f12e381268abcac7ae9b3d3c51bd3178cb | |
| parent | 9c74b9440108c88802f656f2fad2e8950a4a7650 (diff) | |
| parent | e8b15e6156fc361d3cb0e093747dab840d58fc7e (diff) | |
| download | git-cdcf08e0689ca030dcfc5aede5eb81d4d8e3f77c.tar.gz | |
Merge branch 'ab/report-corrupt-object-with-type'
* ab/report-corrupt-object-with-type:
  sha1_file: Show the the type and path to corrupt objects
| -rw-r--r-- | sha1_file.c | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c index e42ef96d45..0cd9435619 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2086,6 +2086,7 @@ void *read_sha1_file_repl(const unsigned char *sha1,  {  	const unsigned char *repl = lookup_replace_object(sha1);  	void *data = read_object(repl, type, size); +	char *path;  	/* die if we replaced an object with one that does not exist */  	if (!data && repl != sha1) @@ -2093,8 +2094,16 @@ void *read_sha1_file_repl(const unsigned char *sha1,  		    sha1_to_hex(repl), sha1_to_hex(sha1));  	/* legacy behavior is to die on corrupted objects */ -	if (!data && (has_loose_object(repl) || has_packed_and_bad(repl))) -		die("object %s is corrupted", sha1_to_hex(repl)); +	if (!data) { +		if (has_loose_object(repl)) { +			path = sha1_file_name(sha1); +			die("loose object %s (stored in %s) is corrupted", sha1_to_hex(repl), path); +		} +		if (has_packed_and_bad(repl)) { +			path = sha1_pack_name(sha1); +			die("packed object %s (stored in %s) is corrupted", sha1_to_hex(repl), path); +		} +	}  	if (replacement)  		*replacement = repl;  | 
