[PATCH] Verify index file before we opportunistically update it
- From
Yiannis Marangos <yiannis.marangos@gmail.com>
- Date
- Apr 9, 2014, 22:06 UTC
- Message-ID
- <1397081197-14803-1-git-send-email-yiannis.marangos@gmail.com>
This is a fix for the following bug: http://thread.gmane.org/gmane.comp.version-control.git/245946/focus=245965
I added 2 functions: verify_index_from and verify_index. They return 1 if the sha1 is correct, otherwise 0. I choose to not die if any errors are occurred because we just want to not proceed to "opportunistic update".
Some questions: 1) Is it better to have these functions as static? 2) If the answer of (1) is no, should I define verify_cache*() also? 3) If something goes wrong in verify_hdr(), it will print an error message, should I make a "quietly" version of it?
Yiannis Marangos (1): Verify index file before we opportunistically update it
cache.h | 3 +++ read-cache.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 71 insertions(+), 11 deletions(-)
-- 1.9.1