]> arthur.barton.de Git - bup.git/commitdiff
Add a --no-check-device option to bup index (cf. tar).
authorZak Wilcox <iwilcox@iwilcox.me.uk>
Fri, 1 Jun 2012 09:10:36 +0000 (10:10 +0100)
committerRob Browning <rlb@defaultvalue.org>
Mon, 18 Mar 2013 01:22:32 +0000 (20:22 -0500)
Ignore stat.st_dev when comparing files against existing index entries, like
git does without #define USE_STDEV:

  http://www.kernel.org/pub/software/scm/git/docs/v1.7.10.1/technical/racy-git.txt

See also: "info tar".

Signed-off-by: Zak Wilcox <iwilcox@iwilcox.me.uk>
[rlb@defaultvalue.org: change original --ignore-dev to --no-check-device to match tar.
 Adjust code to work with current master.
 Remove tests -- will be reintroduced shortly.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/index-cmd.py
lib/bup/index.py

index 5a8913d378733d32435c57c8708031891067c089..6f743c6555034fdacc0bf556f978be29f77dc54f 100755 (executable)
@@ -117,7 +117,8 @@ def update_index(top, excluded_paths):
             # in from_stat().
             meta.ctime = meta.mtime = meta.atime = 0
             meta_ofs = msw.store(meta)
-            rig.cur.from_stat(pst, meta_ofs, tstart)
+            rig.cur.from_stat(pst, meta_ofs, tstart,
+                              check_device=opt.check_device)
             if not (rig.cur.flags & index.IX_HASHVALID):
                 if hashgen:
                     (rig.cur.gitmode, rig.cur.sha) = hashgen(path)
@@ -179,6 +180,7 @@ clear      clear the index
  Options:
 H,hash     print the hash for each object next to its name
 l,long     print more information about each file
+no-check-device don't invalidate an entry if the containing device changes
 fake-valid mark all index entries as up-to-date even if they aren't
 fake-invalid mark all index entries as invalid
 f,indexfile=  the name of the index file (normally BUP_DIR/bupindex)
index 4fdb8e4963a6b62d6852dbf3d871671f0bcb5108..1f3c777c8ed9e804aa011b5b8773bc76f0b33334 100644 (file)
@@ -174,10 +174,12 @@ class Entry:
             log('pack error: %s (%r)\n' % (e, self))
             raise
 
-    def from_stat(self, st, meta_ofs, tstart):
-        old = (self.dev, self.ino, self.nlink, self.ctime, self.mtime,
+    def from_stat(self, st, meta_ofs, tstart, check_device=True):
+        old = (self.dev if check_device else 0,
+               self.ino, self.nlink, self.ctime, self.mtime,
                self.uid, self.gid, self.size, self.flags & IX_EXISTS)
-        new = (st.st_dev, st.st_ino, st.st_nlink, st.st_ctime, st.st_mtime,
+        new = (st.st_dev if check_device else 0,
+               st.st_ino, st.st_nlink, st.st_ctime, st.st_mtime,
                st.st_uid, st.st_gid, st.st_size, IX_EXISTS)
         self.dev = st.st_dev
         self.ino = st.st_ino