]> arthur.barton.de Git - bup.git/commitdiff
Add a bup "tick" before indexing to avoid timestamp race.
authorRob Browning <rlb@defaultvalue.org>
Sat, 24 Mar 2012 16:47:09 +0000 (11:47 -0500)
committerRob Browning <rlb@defaultvalue.org>
Fri, 17 Aug 2012 18:42:58 +0000 (13:42 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/index-cmd.py

index 8195674390758c4fad0f7f655601c31b4cd85b88..a2df5115492dcdc9b99ee0d6d7f5c01a7cd1e73a 100755 (executable)
@@ -146,6 +146,13 @@ if (opt.fake_valid or opt.fake_invalid) and not opt.update:
 if opt.fake_valid and opt.fake_invalid:
     o.fatal('--fake-valid is incompatible with --fake-invalid')
 
+# FIXME: remove this once we account for timestamp races, i.e. index;
+# touch new-file; index.  It's possible for this to happen quickly
+# enough that new-file ends up with the same timestamp as the first
+# index, and then bup will ignore it.
+tick_start = time.time()
+time.sleep(1 - (tick_start - int(tick_start)))
+
 git.check_repo_or_die()
 indexfile = opt.indexfile or git.repo('bupindex')