aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-07-14 21:46:48 -0400
committerJunio C Hamano <gitster@pobox.com>2008-07-14 23:35:32 -0700
commitac9391093f54370ff3f06470e24d78b536a12327 (patch)
tree256cb6bab6ae98cb5c00017885bd658c8757ace5 /cache.h
parent25a1f374f0ff23a4d9191436226ab68f3da5e83a (diff)
downloadgit-ac9391093f54370ff3f06470e24d78b536a12327.tar.gz
git-ac9391093f54370ff3f06470e24d78b536a12327.tar.xz
restore legacy behavior for read_sha1_file()
Since commit 8eca0b47ff1598a6d163df9358c0e0c9bd92d4c8, it is possible for read_sha1_file() to return NULL even with existing objects when they are corrupted. Previously a corrupted object would have terminated the program immediately, effectively making read_sha1_file() return NULL only when specified object is not found. Let's restore this behavior for all users of read_sha1_file() and provide a separate function with the ability to not terminate when bad objects are encountered. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 0d8eddac7..a8254e2f9 100644
--- a/cache.h
+++ b/cache.h
@@ -538,6 +538,9 @@ extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsig
extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
extern int force_object_loose(const unsigned char *sha1, time_t mtime);
+/* just like read_sha1_file(), but non fatal in presence of bad objects */
+extern void *read_object(const unsigned char *sha1, enum object_type *type, unsigned long *size);
+
extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type);
extern int move_temp_to_file(const char *tmpfile, const char *filename);