]> arthur.barton.de Git - bup.git/commitdiff
cmd-index: auto-invalidate entries without a valid sha1 or gitmode.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 28 Feb 2010 20:51:16 +0000 (15:51 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 28 Feb 2010 22:49:10 +0000 (17:49 -0500)
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
index.py

diff --git a/git.py b/git.py
index cc425c17827bc3dbc741ca4b4a0fe32b874fb16e..c5381f0c1c27f972e509e0ddbbcdee5a308045d2 100644 (file)
--- 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)
index 299546c6744815a66b0fe5e9236127639d07269a..cfc42aa0fbe4e756fde2f9408c12df7fa2740d9a 100644 (file)
--- 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):