From 550ee55b5973861b80ebda242e13eb373d0e1ac6 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 28 Feb 2010 15:51:16 -0500 Subject: [PATCH] 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. --- git.py | 1 + index.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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): -- 2.39.2