From: Avery Pennarun Date: Sun, 28 Feb 2010 20:51:16 +0000 (-0500) Subject: cmd-index: auto-invalidate entries without a valid sha1 or gitmode. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=550ee55b5973861b80ebda242e13eb373d0e1ac6;p=packages%2Fb%2Fbup.git cmd-index: auto-invalidate entries without a valid sha1 or gitmode. Not exactly sure where these entries came from; possibly a failed save or an earlier buggy version of bup. But previously, they weren't auto-fixable without deleting your bupindex. --- diff --git a/git.py b/git.py index cc425c1..c5381f0 100644 --- a/git.py +++ b/git.py @@ -390,6 +390,7 @@ class PackWriter: l = [] for (mode,name,bin) in shalist: assert(mode) + assert(mode != '0') assert(mode[0] != '0') assert(name) assert(len(bin) == 20) diff --git a/index.py b/index.py index 299546c..cfc42aa 100644 --- a/index.py +++ b/index.py @@ -93,7 +93,8 @@ class Entry: self.size = st.st_size self.mode = st.st_mode self.flags |= IX_EXISTS - if int(st.st_ctime) >= tstart or old != new: + if int(st.st_ctime) >= tstart or old != new \ + or self.sha == EMPTY_SHA or not self.gitmode: self.invalidate() def is_valid(self):